on *:text:!check &:#:{
var %n 1,%s
while ($sock(isfollowing $+ %n)) inc %n
%s = isfollowing $+ %n
sockclose %s
sockopen %s albinstuff.net 80
sockmark %s $2 $chan
}
on *:sockopen:isfollowing*:{
tokenize 32 $sock($sockname).mark
if ($sockerr) msg $2 Can't connect to website
else {
var %s sockwrite -n $sockname
%s GET $+(/twitch2.php?id=,$urlencode($1),&follows=,$urlencode($2))
%s Host: albinstuff.net
%s
}
}
on *:sockread:isfollowing*:{
var %a
tokenize 32 $sock($sockname).mark
if ($sockerr) msg $2 An error occured while reading.
else {
if (!$3) {
sockread %a
if (!$sockbr) return
if (%a == $null) sockmark $sockname $1-2 1
}
else {
sockread -f %a
if ($sockbr) {
if (%a == true) msg $2 $1 is a follower
else msg $2 $1 is not a follower
}
}
}
}
alias -l urlencode return $regsubex($1, /(\W)/g, $+(%, $base($asc(\t), 10, 16, 2)))