alias -l username return <your username>
alias -l password return <your password>
alias -l raiseerror {
echo -a * /twitter: $1-
halt
}
alias -l urlencode return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
alias twitter {
hfree -w twitter
sockclose twitter
sockopen twitter twitter.com 80
sockmark twitter status= $+ $urlencode($1-)
}
on *:sockopen:twitter:{
if ($sockerr) {
sockclose twitter
raiseerror socket error. Try again later.
}
var %s = sockwrite -n twitter
%s POST /statuses/update.xml HTTP/1.1
%s Host: twitter.com
%s Authorization: Basic $encode($+($username,:,$password),m)
%s Accept: */*, *.*
%s Connection: close
%s User-Agent: mIRC/ $+ $version
%s Content-Type: application/x-www-form-urlencoded
%s Content-Length: $len($sock(twitter).mark)
%s
%s $sock(twitter).mark
}
on *:sockread:twitter:{
var %data
sockread %data
if ($regex(%data,/<error>(.+?)</error>/)) {
hfree -w twitter
sockclose twitter
raiseerror $regml(1)
}
if ($regex(%data,/<(.+?)>(.+?)</\1>/)) hadd -m twitter $regml(1) $regml(2)
elseif (%data == </status>) .signal twitterpost
}