All pastes #968023 Raw Edit

Someone

public text v1 · immutable
·published 2008-04-02 19:53 UTC
rendered paste body
on $*:TEXT:/^[!@]urban?/Si:#:{ 
  set %colnick $nick
  if ($2 !== $Null) && ($len($2-) < 32) {
    set %urbansearch $2-
    set %msg.urban $iif($left($1,1) = @,msg #,notice $nick) 
  sockopen urban www.rscript.org 80  }
  elseif ($2 == $Null) {
    notice $nick $s2((Error)) $s1(You must search for something) 
  }
  elseif ($len($2-) > 32) {
  notice $nick $s2((Error)) $s1(My search is limited to 32 characters) }
}
on *:SOCKOPEN:urban:{
  sockwrite -nt $sockname GET /lookup.php?type=urban&search= $+ $replace(%urbansearch,$chr(32),+)  HTTP/1.1
  sockwrite -nt $sockname Host: www.rscript.org
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:urban:{
  if ($sockerr) {  notice Jolly Socket Error: $sockname $+ . $chr(124) Error code: $sockerr | halt }
  else {
    var %urbanread
    sockread %urbanread
    if (*defined*1* iswm %urbanread) { 
      tokenize 32 %urbanread
      set %definition $remove($3-,&quot;) 
      set %number $chr(35) $+ $remove($2,$chr(46)) 
      if (*example*:* iswm %urbanread) { 
        tokenize 32 %urbanread
      set %example $2-  }
      if (*matches*:* iswm %urbanread) { 
        tokenize 32 %urbanread
      set %matches $2 }
      timer 1 4 %msg.urban $c2(Results for phrase:) $c1(" $+ %urbansearch $+ ") $c2(%number) $s5(::) $c2(%matches) $s5(::) $c1(%definition)
      timer 1 4 %msg.urban $c2(Example:) $c1(%example) 
      sockclose $sockname 
      unset %msg.urban
    unset %urbansearch } 
    elseif (*matches:*0* iswm %urbanread) { 
      timer 1 1 %msg.urban $c2(No results found for) $c1(" $+ %urbansearch $+ ")
      unset %msg.urban
      unset %urbansearch
  sockclose $sockname } }
}