All pastes #421478 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-02 21:10 UTC
rendered paste body
on $*:TEXT:/^[!@.](dictionary|dict|difine|define) */si:#: {
  if (!$2) {
    /notice $nick 1Please specify a word.
  }
  else {
    if ($sock(define)) .sockclose define
    set %dict.search $2-
    set %dict.return notice $nick
    is (@ isin $1) set %dict.return msg $chan
    sockopen define www.thefreedictionary.com 80
  }
}
on *:SOCKOPEN:define: {
  sockwrite -nt $sockname GET / $+ %dict.search HTTP/1.1
  sockwrite -nt $sockname Host: www.thefreedictionary.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:define: {
  if ($sockerr) {
    %dict.return Socket Error: $sockname $chr(124) Error code: $sockerr $chr(124) Please inform $me of this message.
  }
  else {
    var %dict.read
    sockread %dict.read
    if (*1.* iswm %dict.read) { set %dict.define $htmlfree(%dict.read)
      %dict.return 1You Searched:4 %dict.search
      %dict.return 1Definition:4 %dict.define
      %dict.return 12 $+ $chr(91) $+ 1 $+ $chr(90) $+ $chr(119) $+ $chr(101) $+ $chr(107) $+ 12 $+ $chr(93)
      unset %dict.*
      sockclose $sockname
    }
  }
}
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&amp;) | return %x }