@GTAXL Here is is.gd
;is.gd url shortener by Ford_Lawnmower irc.abjects.net #mIRC
alias -l is.gd.logo return $+($chr(2),$chr(3),04,$chr(44),00,IS,$chr(15))
menu Channel,Status {
.$iif($group(#is.gd) == On,$style(1)) is.gd Trigger
..$iif($group(#is.gd) == On,$style(2)) On: .enable #is.gd
..$iif($group(#is.gd) == Off,$style(2)) Off: .disable #is.gd
}
#is.gd on
On $*:Text:/^(\+|-|!|@)gd*/Si:#: {
var %action $regml(1)
if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
if (%action == +) {
if ($istok(%is.gdChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the is.gd script }
else {
.enable #is.gd
Set %is.gdChanList $addtok(%is.gdChanList,$+($network,$chan),32)
.msg $chan $nick has activated the is.gd script for $chan .
}
}
else {
if (!$istok(%is.gdChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the is.gd script }
else {
Set %is.gdChanList $remtok(%is.gdChanList,$+($network,$chan),1,32)
.msg $chan $nick has deactivated the is.gd script for $chan .
}
}
}
elseif (!$timer($+(is.gd,$network,$nick))) && ($istok(%is.gdChanList,$+($network,$chan),32)) {
.timer $+ $+(is.gd,$network,$nick) 1 6 noop
var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
Getis.gd %method $2-
}
}
#is.gd end
alias is.gd { Getis.gd echo -a $1- }
alias -l Getis.gd {
var %sockname $+(is.gd,$network,$2,$ticks)
sockopen %sockname is.gd 80
sockmark %sockname $1-2 $+(/create.php?url=,$urlencode($3))
}
On *:sockopen:is.gd*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:is.gd*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %is.gd | sockread %is.gd
if ($regex(comment,%is.gd,/createformlabel">(.*?)</i) && $regex(%is.gd,/id="short_url"\svalue="(.*?)"/i)) {
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo $regml(comment,1)
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo $+($chr(31),$regml(1))
}
elseif ($regex(comment,%is.gd,/createformlabel">(.*?)</i)) {
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo $regml(comment,1)
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo *invalid url*
}
}
}
alias -l urlencode { return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2)) }