alias googlesearch { var %x = 1 while ($sock($+(google,%x))) inc %x sockopen $+(google,%x) www.google.com 80 sockmark $+(google,%x) $1- } ON *:SOCKOPEN:google*: { if ($sockerr) { var %cmd = $gettok($sock($sockname).mark,1,32) %cmd Socket error $sockerr return } sockwrite -n $sockname GET $+(/search?q=,$phex($gettok($sock($sockname).mark,2-,32)),&btnI=I%27m+Feeling+Lucky HTTP/1.0) sockwrite $sockname $crlf } on *:SOCKREAD:google*: { var %f, %cmd, %result %cmd = $gettok($sock($sockname).mark,1,32) if ($sockerr) { %cmd Socket error $sockerr return } while (1) { sockread %f if (!$sockbr) break if (here. iswm %f) { %result = $gettok(%f,2,34) sockclose $sockname break } elseif (HTTP/1.0 200 OK = %f) { %result = There are no results. sockclose $sockname break } } if (%result) { %cmd %result } } alias google { googlesearch google2 $1- } alias google2 { echo $colour(info) -a *** Google search: $1- } ; !google query in a channel will message the channel with the results. alias google3 { notice %google3 : $1- | unset %google3 } on *:TEXT:!google *:#: { set %google3 $nick googlesearch google3 $2- } ; !google query in a channel will message the channel with the results. alias google3 { msg %google3 Google search: $1- | unset %google3 } on *:TEXT:@google *:#: { set %google3 $nick googlesearch google3 $2- } ; Convert some text to hexadecimal form alias phex { var %x = 1, %s = $len($1), %r, %w while (%x <= %s) { %w = $mid($1,%x,1) if ($asc(%w) = 32) { %r = $+(%r,+) } elseif ($asc(%w) !isnum 65-90) && ($asc(%w) !isnum 97-122) && ($asc(%w) !isnum 48-57) { %r = $+(%r,%,$base($asc(%w),10,16,2)) } else { %r = $+(%r,%w) } inc %x } return %r }