;Please credit:public spell checker by bl4h (joey@shady.nu) http://shady.nu
on *:sockopen:pdick:{
if ($sockerr > 0) {
pssend Unable to connect to the spell server $+ ! Try again later.
hfree pdic
halt
}
}
alias pssend { $iif(%pspell.mess == 1,.msg,.notice) $iif(%pspell.type == 1,$hget(pdic,chan),$hget(pdic,nick)) $1- }
on *:TEXT:!spell*:#:{
;Message type: 1=msg 2=notice (change following line)
%pspell.mess = 1
;Send messages to chan or private to the user: 1=public 2=private (change following line)
%pspell.type = 1
;It will not proccess more than one spell check in 3 seconds (flood protection)
if ($hget(pdic,string)) { msg $chan $nick , Search in progress. Please wait. | halt }
if ($hget(pdicfld,flood) > 0) { halt }
if (!$2) { msg $chan Usage: !spell <word> - Word must be less than 50 characters, and I will process only 1 query every 3 seconds. | halt }
if ($len($2) > 50) { halt }
if (!$hget(pdic)) { hmake pdic }
if (!$hget(pdicfld)) { hmake pdicfld }
hadd pdicfld flood 3
hdec -c pdicfld flood
hadd pdic string $2-
hadd pdic db wn
hadd pdic match 0
hadd pdic chan $chan
hadd pdic nick $nick
if ($sock(pdick)) {
smdic MATCH $hget(pdic,db) exact " $+ $hget(pdic,string) $+ "
}
if (!$sock(pdick)) { hadd pdic auth no | sockopen pdick dict.org 2628 }
}
alias smdic { sockwrite -n pdick $1- }
on *:sockread:pdick:{
if ($sockerr > 0) { return }
:nextread
sockread %stalk
if (%stalk == $null) { return }
if ($sockbr == 0) { return }
if ($left(%stalk,3) == 220 && $hget(pdic,auth) == no) { hadd pdic auth yes | smdic MATCH $hget(pdic,db) exact " $+ $hget(pdic,string) $+ " | halt }
if ($left(%stalk,3) == 220) { smdic CLIENT "mirc addon by bl4hster@gmail.com" | halt }
if ($hget(pdic,catch) == 1) {
%pdic.def = %pdic.def $gettok(%stalk,2,32)
}
if ($left(%stalk,3) == 552) {
if ($hget(pdic,match) == 0) {
hadd pdic match 1
%pdic.def = $hget(pdic,string) is 4INCORRECT. Suggestions:
smdic MATCH $hget(pdic,db) lev " $+ $hget(pdic,string) $+ "
halt
}
if ($hget(pdic,match) == 1) {
hadd pdic match 2
smdic MATCH ! exact " $+ $hget(pdic,string) $+ "
halt
}
if ($hget(pdic,match) == 2) {
msg $hget(pdic,chan) %pdic.def NO MATCHES!
hfree pdic
halt
}
}
if ($left(%stalk,3) == 420) { pssend Internal ERROR: Server temporarily unavailable }
if ($left(%stalk,3) == 421) { echo -a !spell: Internal ERROR: Server shutting down at operator request }
if ($left(%stalk,3) == 530) { pssend Internal ERROR: Access to server denied. }
if ($left(%stalk,3) == 152) {
if ($hget(pdic,match) == 0) {
pssend $hget(pdic,nick) $+ , $hget(pdic,string) is 3CORRECT
hfree pdic
halt
}
if ($hget(pdic,match) == 1 || $hget(pdic,match) == 2) {
hadd pdic catch 1
}
}
if (%stalk == .) {
if ($hget(pdic,catch) == 1) {
pssend %pdic.def
hfree pdic
halt
}
}
return
:error
echo -s Weird !spell error. Clearing variables.
hfree pdic
sockclose pdick
halt
}