# google.tcl v0.1 # by aNa|0Gue - analogue@glop.org - http://www.glop.org package require http bind pub - !help pub:help bind pub - !google pub:google proc pub:help { nick uhost handle channel arg } { putserv "NOTICE $nick :!google google sur IRC !" } proc pub:google { nick uhost handle channel arg } { if {[llength $arg]==0} { putserv "PRIVMSG $channel :hey ! tappes des mots boulet !" } else { set query "http://www.google.fr/search?btnI=&q=" for { set index 0 } { $index<[llength $arg] } { incr index } { set query "$query[lindex $arg $index]" if {$index<[llength $arg]-1} then { set query "$query+" } } # putserv "PRIVMSG $channel :$query" set token [http::geturl $query] puts stderr "" upvar #0 $token state set max 0 foreach {name value} $state(meta) { if {[regexp -nocase ^location$ $name]} { set newurl [string trim $value] putserv "PRIVMSG $channel :$newurl" } } } }