Downloading File
Filename: Urban Dictionary Search
on *:TEXT:*:#: {
if ($strip($1) == !UrbanS) {
inc -u30 $+(%,_Urban_F1,.,$chan,.,$nick)
if ($($+(%,_Urban_F1,.,$chan,.,$nick),2) == 8) { inc %_UBNINC1 | .notice $nick �D 1 $+ $nick $+ 14,1 Please wait and allow others to search.Count: 1 $+ $chr(35) $+ %_UBNINC1 $+ Noticed. | halt }
if ($($+(%,_Urban_F1,.,$chan,.,$nick),2) >= 9) { halt }
var %_DE_C = $strip($3)
if (%_UBLOCK == On) { .notice $nick �D 1 $+ $nick $+ 14,1 Search In progress please wait... | halt }
if (!$strip($2)) || (!$strip($3)) || (!$strip($4)) || ($strip($4) !isnum $strip($4)) { .notice $nick �D 1 $+ $nick $+ 14,1 You must search for a WORD and pick either DEFINITION or EXAMPLE and the number of the definition/example you wish to search for.Syntax: 1!UrbanS Napa Definition 4 OR 1!UrbanS Napa Example 4 | halt }
if (!$regex($strip($3),/(Definition|Example)/i)) { .notice $nick �D 1 $+ $nick $+ 14,1 You must search for a WORD and pick either DEFINITION or EXAMPLE and the number of the definition/example you wish to search for.Syntax: 1!UrbanS Napa Example 4 | halt }
inc -u10 $+(%,_Urban_F2,.,$chan,.,$nick)
if ($($+(%,_Urban_F2,.,$chan,.,$nick),2) == 2) { inc %_UBNINC2 | .notice $nick �D 1 $+ $nick $+ 14,1 Please wait and allow others to search.Count: 1 $+ $chr(35) $+ %_UBNINC2 $+ Noticed. | halt }
if ($($+(%,_Urban_F2,.,$chan,.,$nick),2) >= 3) { halt }
if ($sock(_URBAN)) sockclose _URBAN
unset %_UBSLN
set -u10 %_UBLOCK On
set %_UBS /define.php?term= $+ $strip($2)
set %_UBS2 $strip($2)
set %_UBChoose $strip($3)
set %_UBSN $strip($4)
set %_UBChan $chan
.timer 1 5 _UB_Check
sockopen _URBAN www.urbandictionary.com 80
}
}
on *:SOCKOPEN:_URBAN: {
sockwrite -nt $sockname GET %_UBS HTTP/1.1
sockwrite -nt $sockname HOST:www.urbandictionary.com
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:_URBAN: {
var %_UB1
sockread %_UB1
if ($regex(%_UB1,/(\<div id='not_defined_yet'>)/i) == 1) { msg %_UBChan �D 1 $+ %_UBS2 $+ 14 has not been defined yet.Click here to be the first to define it: 1 $+ http://www.urbandictionary.com/add.php?word= $+ %_UBS2 | unset %_UBLOCK |sockclose $sockname | halt }
if ($regex(%_UB1,/(\<div class=' $+ %_UBChoose $+ '>)/i) == 1) {
inc %_UBSLN
sockread %_UB1
if (%_UBSLN == %_UBSN) {
writeini Urban.ini Urbanw %_UBS2 $calc($readini(Urban.ini,Urbanw,%_UBS2) + 1 )
msg %_UBChan �D 14Urban $upper(%_UBChoose) 1 $+ $chr(35) $+ %_UBSN $+ 14 Results For 1 $+ %_UBS2 $+ 14:
msg %_UBChan �D 14 $+ $regsubex($htmlfree($remove(%_UB1,$chr(13))),/(")/g, " ) $+ .1 $+ %_UBS2 $+ 14 has been searched for1: $calc($readini(Urban.ini,Urbanw,%_UBS2)) $+ 14 times.
unset %_UBLOCK
sockclose $sockname
}
}
}
alias -l _UB_Check {
if (%_UBSN > %_UBSLN) { msg %_UBChan �D 14There where only: 1' $+ %_UBSLN $+ '14 possible Urban $upper(%_UBChoose) results for 1 $+ %_UBS2 $+ 14. | unset %_UBLOCK | sockclose _URBAN | halt }
}
on 1:sockclose:ubub: {
if (%_UBSN > %_UBSLN) { msg %_UBChan �D 14There where only: 1' $+ %_UBSLN $+ '14 possible Urban $upper(%_UBChoose) results for 1 $+ %_UBS2 $+ 14. | unset %_UBLOCK | sockclose _URBAN | halt }
}
alias htmlfree {
var %a,%b
%b = $regsub($1-,/[^<]*>|<[^>]*>|<[^>]*/g,$chr(32),%a)
return %a
}


