== TinyURL-Previewer ==
If somebody posts a TinyURL the Bot shows the URL behind.
So you cannot be trapped by illegal, virus or malware Pages. [Like nimp]
The URL uses the On *:TEXT: Trigger and automatically finds the $1,2,3-String where the URL is stored.
Defined %mirc.temp as Local, so it won't mess up with other scripts.
Fixed that lazy sockclose bug.
#### Get TinyURL-Links and convert them.
alias tinyurl-connection {
set %tinyurl-c $remove($1,http://,www.,tinyurl.com)
set %tinyurl-full $1
sockopen tinyurl tinyurl.com 80 }
on *:SOCKOPEN:tinyurl:{
; connection
sockwrite -n $sockname GET %tinyurl-c HTTP/1.1
; Write Connection Details
sockwrite -n $sockname Host: preview.tinyurl.com
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:tinyurl:{
var %mirc.temp 0
sockread %mirc.temp
if (<blockquote><b> isin %mirc.temp) {
msg %tinyurl-chan 00,02TinyURL ( $+ %tiny-full $+ ) redirects to: $remove(%mirc.temp,<blockquote>,<b>,</b>,<br />,</blockquote>)
}
}
on *:SOCKCLOSE:tinyurl:{ unset %tinyurl-* }
on *:TEXT:*:#:{
sockclose tinyurl
set %tinyurl-chan $chan
var %i 1
while ([ $chr(36) $+ [ %i ] ]) {
if (tinyurl.com/ isin [ $chr(36) $+ [ %i ] ]) { tinyurl-connection [ $chr(36) $+ [ %i ] ] }
inc %i
}
}
## PowerScripters for President.