When somebody posts a link in a channel, this will echo the title of the page to you, so you know what you're clicking on. Only detects links that begin the line, not in the middle (95% of links are posted as their own line)
on *:text:http*:#:{
var %a = $iif(*www.* iswm $1- || $count($gettok($1-,2,47),$chr(46)) == 1,$iif(*www.* iswm $1-,$gettok($gettok($1-,2,47),2-,46),$gettok($1-,2,47)),$gettok($1-,2,47))
set %title.site %a
set %title.chan #
if ($chr(47) isin $gettok($1-,2-,46)) && ($gettok($1-,3,47)) set %title.site2 $+($chr(47),$gettok($1-,3-,47))
sockopen findtitle %a 80
}
on *:sockread:findtitle:{
if ($sockerr) {
echo %title.chan Error finding title.
sockclose findtitle
unset %title.*
halt
}
else {
var %', %hee
sockread %'
%hee = $z(%')
if (*<*title>* iswm %') {
echo %title.chan Title: $remove($strip(%hee),$chr(9))
unset %title.*
sockclose findtitle
halt
}
}
}
alias -l z {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
on *:sockopen:findtitle:{
sockwrite -n $sockname GET $iif(%title.site2,%title.site2,$chr(47)) HTTP/1.1
sockwrite -n $sockname Host: %title.site $+ $crlf $+ $crlf
}