 |
|
 |
|
TrAsNeT Junior 2


Data inscrierii: 12/Mai/2008 Mesaje: 44 Localitate: Sighet
|
|
 |
|
 |
|
Trimis: 13/05/2008 23:43 Titlul subiectului: |
|
|
package require http
bind pub -|- .verify checkcsc
bind pub -|- !verify checkcsc
bind pub -|- .csc checkcsc
bind pub -|- !csc checkcsc
bind pub -|- !cservice checkcsc
proc checkcsc {nick host hand chan arg} {
if { [channel get $chan cservice] } {
set valchan [join [lindex [split $arg] 0]]
set token [http::config -useragent "lynx"]
set dachan [wt:filter $valchan]
set token [http::geturl "http://194.109.147.174/live/check_app.php?name=$dachan"]
set html [http::data $token]
putlog "\00304 Checking application for $valchan in CService Database."
if {[string match "*No applications*" $html]} {
puthelp "PRIVMSG $chan :$valchan: No cservice application"
putlog "Done posted results for $valchan in $chan"
return 0
}
if {[string match "*DB is currently being maintained*" $html]} {
puthelp "PRIVMSG $chan :$valchan: The cservice database is currently down"
putlog "Done posted results for $valchan in $chan"
return 0
}
#Get header for redirect
upvar #0 $token state
foreach {name value} $state(meta) {
if {[regexp -nocase ^location$ $name]} {
set regurl "http://cservice.undernet.org/live/$value"
set token [http::geturl $regurl]
set html [http::data $token]
set html [split $html "\n"]
set regobj 0
set regcomment ""
foreach line $html {
if {[string match "*by user :*" $line]} {
regexp {(.*)<b>(.*)</b>(.*)} $line match blah reguser blah
}
if {[string match "*Posted on :*" $line]} {
regexp {(.*)<b>(.*)</b>(.*)} $line match blah regdate blah
}
if {[string match "*Current status :*" $line]} {
regexp {(.*)<b>(.*)</b>(.*)} $line match blah regstatus blah
regsub -all {<[^>]*>} $regstatus {} regstatus
}
if {[string match "*Decision comment :*" $line]} {
regexp {(.*)<b>(.*)</b>(.*)} $line match blah regcomment blah
regsub -all {<[^>]*>} $regcomment ": " regcomment
}
if {[string match "*Comment :*" $line]} {
incr regobj 1
}
}
}
}
set regstatus2 [string tolower $regstatus]
if {$regstatus2 == "pending"} {
set regstatus "\00312$regstatus"
} elseif {$regstatus2 == "incoming"} {
set regstatus "\00308$regstatus"
} elseif {$regstatus2 == "rejeced"} {
set regstatus "\00304$regstatus"
} elseif {$regstatus2 == "accepted"} {
set regstatus "\00309$regstatus"
} elseif {$regstatus2 == "ready for review"} {
set regstatus "\00306$regstatus"
} elseif {$regstatus2 == "cancelled by the applicant"} {
set regstatus "\00314$regstatus"
}
puthelp "PRIVMSG $chan :\00307$valchan \00314Application: $regstatus \00302| \00314user: \00301$reguser \00302| \00314submitted: \00301$regdate \00302| \00314Objections: \00304$regobj \00302| \00314Comment: \00304 $regcomment \00302| \00314URL: \00301$regurl"
putlog "Done posted results for $valchan in $chan"
return 0
}
}
proc wt:filter {x {y ""} } {
for {set i 0} {$i < [string length $x]} {incr i} {
switch -- [string index $x $i] {
"é" {append y "%E9"}
"è" {append y "%E8"}
"î" {append y "%CE"}
"É" {append y "%E9"}
"È" {append y "%E8"}
"Î" {append y "%CE"}
"&" {append y "%26"}
"#" {append y "%23"}
" " {append y "+"}
default {append y [string index $x $i]}
}
}
return $y
}
#################################################################################
putlog "Module loaded: cservice" |
|