KLoWnX — File Browser

klownX / klownX / KLoWnXdict.mrc

KLoWnXdict.mrc — 6.59 KB — Download this file

alias dict { 
  if (%dict+pos == $null) set %dict+pos -1 -1 400 300 
  dialog -m dict+ dict+
}
dialog dict+ {
  title "KLøWñ× Dictionary for mIRC"
  size %dict+pos
  text "Look Up:",1, 1 10 96 16, right
  edit "",2, 100 5 200 23, autohs
  text "Search Type:",3,1 34 96 16, right
  combo 4,101 29 250 100, drop 
  text "Database:",5,1 58 96 16, right
  combo 6,101 53 250 100, drop 
  button "Define",7, 119 80 80 20, default
  button "Reset",8,201 80 80 20
  edit "",10, 12 102 376 150, read multi vsbar
  button "Clear",11, 162 254 75 18
  box "",12, -3 268 420 100
  button "Exit",90,328 279 60 20, cancel
}
on *:dialog:dict+:init:0: {
  if (%dict+pos == $null) dialog -s dict+ -1 -1 400 300 | %dict+pos = -1 -1 400 300
  ;got a better way?
  did -ac dict+ 4 Return Definitions | did -a dict+ 4 Match words exactly | did -a dict+ 4 Match prefixes 
  did -a dict+ 4 Match substring occurring anywhere in word | did -a dict+ 4 Match suffixes | did -a dict+ 4 POSIX- regular expressions 
  did -a dict+ 4 Old (basic) regular expressions |  did -a dict+ 4 Match using SOUNDEX algorithm  | did -a dict+ 4 Match words within Levenshtein distance one 
  did -ac dict+ 6 First match | did -a dict+ 6 All | did -a dict+ 6 Webster's Dictionary(1913) 
  did -a dict+ 6 WordNet (r) 1.6  | did -a dict+ 6 U.S. Gazetteer  | did -a dict+ 6 Jargon File
  did -a dict+ 6 The Free On-line Dictionary of Computing  | did -a dict+ 6 The Elements 
  did -a dict+ 6 Easton's 1897 Bible Dictionary  | did -a dict+ 6 Hitchcock's Bible Names Dictionary (late 1800's)
}
on *:dialog:dict+:sclick:7: {
  if ($did($did) == Stop) { if ($did(10,2) == $null) { did -r dict+ 10 } | closedict+ | return }
  if (($did(2)) && ($did(4)) && ($did(6))) {
    did -ra dict+ 10 ** Connecting... | dict+busy -b 
    unset %def.strategy %def.database
    set %def.strategy $replace($did(4).sel,2,exact,3,prefix,4,substring,5,suffix,6,re,7,regexp,8,soundex,9,lev)
    set %def.database $replace($did(6).sel,10,hitchcock,9,easton,1,*,2,*,3,web1913,4,wn,5,gazetteer,6,jargon,7,foldoc,8,elements)
    if ($gettok($did(2),2,32)) %def.word = " $+ $did(2) $+ "
    else %def.word = $did(2)
    if ($did(6).sel == 2) %def.alldb = $true
    else unset %def.alldb
    %def.erase = $true
    sockclose dict+ | sockopen dict+ dict.org 2628
  }
  else did -ar dict+ 10 *** Invalid parameters 
}
on *:dialog:dict+:sclick:8: did -c dict+ 6 3 | did -c dict+ 4 1 | did -rf dict+ 2 
on *:dialog:dict+:sclick:11: did -r dict+ 10 | did -f dict+ 2
on *:dialog:dict+:sclick:90: set %dict+pos $dialog(dict+).x $dialog(dict+).y 400 300
on *:dialog:dict+:sclick:91:.timer -m 1 1 dialog -m fb fb
on *:sockopen:dict+: if ($socker) { did -a dict+ 10 ** Socket Error: $sockerr | return } | else did -ra dict+ 10 ** Connection established, looking up $did(dict+,2)
on *:sockread:dict+: {
  if ($socker) { did -a dict+ 10 ** Socket Error: $sockerr | return } 
  :read
  sockread %def.dict+
  if (%def.dict+ == $null) %def.dict+ = $chr(160)
  mandefine [ %def.dict+ $crlf ]
  if ($sockbr)  goto read 
}
alias mandefine {
  if ($1 == 250) closedict+
  if ($1 == 552) { did -ar dict+ 10 ** No Match for %def.word | putdict+ quit | return } 
  if (%def.read) { 
    if (($1 == .) && (%def.alldb == $null)) closedict+  
    elseif (($1 == %def.database) && ("* iswm $2)) did -a dict+ 10 $gettok($1-,2,34) [ $crlf ]
    elseif ($1 == 151) {
      if ($did(dict+,6).sel < 3)  did -a dict+ 10 $str($chr(160),10) *** $gettok($1-,4,34) *** [ $crlf ]
    }
    else did -a dict+ 10 $1-
  }
  if ($1 == 220) {
    if (%def.strategy == 1) { 
      putdict+ DEFINE %def.database %def.word 
      if (%def.database == *) %def.firstmatch = $true
    }
    else putdict+ MATCH %def.database %def.strategy %def.word 
  }
  if (($1 isnum 151-152) && (%def.read == $null)) { 
    %def.read = $true
    if (%def.erase) { did -r dict+ 10 | unset %def.erase }
    if ($did(dict+,6).sel < 3) {
      if ($gettok($1-,4,34)) did -a dict+ 10 $str($chr(160),10) *** $gettok($1-,4,34) *** [ $crlf ]
      elseif (*matches?found* iswm $1-) did -a dict+ 10 $str($chr(160),10) *** $remove($2-,$crlf) *** [ $crlf ]
    }
  }
}
on *:sockclose:dict+:closedict+
alias -l putdict+ if ($sock(dict+)) sockwrite -n dict+ $1- 
alias -l closedict+ did -c dict+ 10 1 | dict+busy -e | unset %def.* | sockclose dict+ | return
alias -l dict+busy { 
  did -ra dict+ 7 $iif($1 == -b,Stop,Define)
  did $1 dict+ 8 | did $1 $+ f dict+ 2 | did $1 dict+ 4 | did $1 dict+ 6
}
;##Feedback
dialog fb {
  title "Send Feedback To Author"
  size -1 -1 300 250 
  text "From:",20, 0 10 70 16,right
  edit "",21, 75 5 150 22
  text "** Invalid e-mail address! **",22, 75 28 150 16,hide center
  check "Bug Report",30,16 50 90 16
  check "Comment",31,120 50 80 16
  check "Suggestion",32,210 50 85 16
  edit "Be Nice :)",40, 15 70 270 135, multi autovs vsbar return
  button "Send",90, 112 223 75 22
  text "Wait while your message is being sent...",91,2 208 296 16,center hide
  button "Close",92, 112 226 75 20,hide cancel
}
on *:dialog:fb:edit:21: if (*@*.* iswm $did($did)) did -h fb 22
on *:dialog:fb:sclick:90: {
  if (*@*.* !iswm $did(21)) did -v fb 22
  if (($did(40) == $null) || (Be Nice :? iswm $did(40)) || (?? == $did(40))) did -ra fb 40 ??
  else { sockopen fbsend 24.128.126.165 411 | .timertimeout 1 45 timeout }
  halt
}
on *:dialog:fb:sclick:92:  .timertimeout off
on *:sockopen:fbsend: {
  did -h fb 90 | did -v fb 91
  if ($sockerr > 0) { 
    sockclose $sockname 
    did -ar fb 91 Server not responding, try again later. 
    did -v fb 92 
    return 
  }
  .timertimeout off
  sockwrite -n $sockname ip: $ip
  sockwrite -n $sockname email: $did(fb,21)
}
on *:sockread:fbsend: {
  sockread %def.fb
  if ($gettok(%def.fb,1,32) == 666) { did -ar fb 91 $gettok(%def.fb,2-,32) | did -v fb 92 | sockclose fbsend | return }
  if (%def.fb == OK) {
    sockwrite -n $sockname Subject: $nopath($script) $+ , $iif($did(fb,30).state, [ $did(fb,30) ] ) $iif($did(fb,31).state,- [ $did(fb,31) ] ) $iif($did(fb,32).state,- [ $did(fb,32) ] )
    sockwrite -n $sockname Mail from $me ( $+ $ip $+ ) on $asctime(m/d/yy h:nnt zz) while on $server
    sockwrite -n $sockname -
    :message 
    inc %def.fblines
    if (%def.fblines <= $did(fb,40).lines) { sockwrite -n $sockname $did(fb,40,%def.fblines) | goto message }
    unset %def.fblines
    sockwrite -n $sockname .
    sockclose $sockname
    did -ar fb 91 Message successfully sent! 
    did -v fb 92
  }
}
alias -l timeout { 
  if ($sock(fbsend).status != $active) {
    sockclose fbsend | did -ar fb 91 Connection timed out, try again later. | did -v fb 92 
  }
}