All pastes #156778 Raw Edit

Untitled

public text v1 · immutable
·published 2006-09-01 00:35 UTC
rendered paste body
;########################
;#    SPELL CHECKER     #
;########################

on $*:TEXT:/^[!@.]spell */Si:#:{
  var %s = 1
  while ($sock($+(spell.,%s))) inc %s
  set $+(%,spell.,%s,.output) $iif($left($1,1) == @,msg $chan,notice $nick)
  set $+(%,spell.,%s,.nick) $nick
  sockopen $+(spell.,%s) smartbot.ej.am 80
  sockmark $+(spell.,%s) $replace($2-,$chr(32),+)
}
on *:SOCKOPEN:spell.*:{
  if ($sockerr) {
    .notice $($+(%,$sockname,.nick),2) Error in the socket: $sockerr $+ while looking for the text: %chekitup
    sockclose $sockname
    unset $+(%,$sockname,.*)
    halt
  }
  sockwrite -nt $sockname GET /bot/parsers/spell.php?text= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -nt $sockname Host: smartbot.ej.am $+ $str($crlf,2)
}
on *:SOCKREAD:spell.*:{
  if ($sockerr) {
    .notice $($+(%,$sockname,.nick),2) Error in the socket: $sockerr $+ while looking for the text: %chekitup
    sockclose $sockname
    unset $+(%,$sockname,.*)
    halt
  }
  var %read
  sockread %read
  echo -a * %read
}

ALIAS striptags { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | return $remove(%x,&nbsp;) }