alias tweet {
set %tw.username YOURLOGIN
set %tw.password YOURPASSWD
if ($len($1-) > 140) {
echo -a Ops, that was $calc($len($1-)-140) ONLY 140 Chars!
halt
}
set %authentication $encode($+(%tw.username,:,%tw.password),m)
sockclose twitter
sockopen twitter twitter.com 80
.timertwitter 1 10 twitter_timeout
set %tweet $$1-
}
alias urlencode return $regsubex($1-,/\G(.)/g,$iif(($prop && \1 !isalnum) || !$prop,$chr(37) $+ $base($asc(\1),10,16),\1))
alias urldecode return $replace($regsubex($1-,/%(\w\w)/g,$chr($iif($base(\t,16,10) != 32,$v1,1))),$chr(1),$chr(32))
on *:sockopen:twitter:{
sockwrite -n twitter POST /statuses/update.json HTTP/1.1
sockwrite -n twitter Host: twitter.com
sockwrite -n twitter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
sockwrite -n twitter Content-Length: $calc($len($urlencode(%tweet)) + 9)
sockwrite -n twitter Authorization: Basic %authentication
sockwrite -n twitter $crlf
sockwrite twitter status=
sockwrite -n twitter $urlencode(%tweet)
sockwrite twitter $crlf
sockwrite twitter $crlf
}
alias twitter_timeout {
echo -a Message Failed to Send - Socket Timeout
sockclose twitter
}
on *:sockread:twitter: {
.timertwitter off
sockread -f %string
echo -a Message Status ( $+ %string $+ )
sockclose twitter
}
menu channel {
Twitter
.Send Tweet { /tweet $?="Mensaje:" }
}
on *:text:!twitter*:#channel:{
/tweet Message from $nick : $2-
}