All pastes #63403 Raw Edit

Untitled

public text v1 · immutable
#63403 ·published 2006-06-09 19:00 UTC
rendered paste body
on *:TEXT:!search *:#:{
  /set %item $$2-
  /set %chan $chan
  /set %nick $nick
  if ($sock(search)) {
    /sockclose search
  }
  /sockopen search google.com 80
}
on *:SOCKOPEN:search:{
  sockwrite -nt $sockname GET /search?hl=en&q= $+ %item $+ &btnG=Google+Search HTTP/1.1
  sockwrite -nt $sockname Host: google.com 
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:search:{
  if ($sockerr) {
    /msg %chan Socket error: $sockerr $+ , while looking up %item
    /unset %item
    /unset %chan
  }
  else {
    var %read
    while (1) {
      sockread -f %read
      var %read = got %read
      write sockettest.txt %read
      if (!$sockbr) { break }
      if (* $+ %item $+ * iswm %read) {
        msg %chan %read
        /unset %item
        /unset %chan
        sockclose $sockname    
      }
    }
  }
}