rendered paste bodyon *:TEXT:*:*:{
if ($1 == !trans) {
if (!$2) {
msg $chan [ $+ Dicitionary $+ ] nothing to Translate!
halt
}
set %trans.input $replace($lower($2-),$chr(32),+)
if $sock(Dicitionary) { sockclose Dicitionary }
sockopen Dicitionary http://www.tranexp.com
set %trans.nick $nick
}
}
on *:SOCKOPEN:Dicitionary: {
sockwrite -n Dicitionary GET /2000/Translate/result.shtml HTTP/1.1
sockwrite -n Dicitionary Host: http://www.tranexp.com
}
on *:SOCKREAD:Dicitionary: {
if ($sockerr) {
notice %trans.nick $cmderror Socket error translating %trans.input $+ !
sockclose Dicitionary
halt
}
else {
var %Dicitionary
sockread %Dicitionary
var %Dicitionary = $htmlfree(%Dicitionary)
if (trans: isin Dicitionary) { notice %trans.nick [ $+ Translation $+ ] $right(%Dicitionary,-6) }
}
}
alias htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}