Thread: [Request script] csc tcl
View Single Post
Old 24-03-2007, 20:24   #7 (permalink)
MasT3r
Junior Member
 
Join Date: Mar 2007
Posts: 8
Rep Power: 0
MasT3r is an unknown quantity at this point
Talking

l-am gasit,l-am facut...cine vrea sa ia codu de aici :
Code:
package require http

bind pub -|- .csc checkcsc

proc checkcsc {nick host hand chan arg} {

        set valchan [join [lindex [split $arg] 0]]
        if { $valchan == "" } { return 0 }
        set token [http::config -useragent "lynx"]
        set check [wt:filter $valchan]
        set token [http::geturl "http://194.109.147.174/live/check_app.php?name=$check"]
        set html [http::data $token]

	if {[string match "*No applications*" $html]} {
                puthelp "PRIVMSG $chan :$valchan: Nu exista nici o aplicatie pentru acest canal"
		    return 0
        }

        if {[string match "*DB is currently being maintained*" $html]} {
                puthelp "PRIVMSG $chan :$valchan: Baza de date de la Cservice are o mica problema,va rugam reveniti !"
		    return 0
        }

        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 {} regcomment2
                                }

                                if {[string match "*Comment :*" $line]} {
                                        incr regobj 1
                                }
                                if {![info exists regcomment2]} {
                                        set regcomment2 "n/a"
                                }
                        }
		}
        }
        set regstatus2 [string tolower $regstatus]
        if {$regstatus2 == "pending"} {
	  set regstatus "11 $regstatus"
        } elseif {$regstatus2 == "incoming"} {
          set regstatus "\00308$regstatus"
        } elseif {$regstatus2 == "rejected"} {
	  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"
        }

	    putserv "PRIVMSG $chan 4,1Canal  0,1 :4,1 $valchan 4Status 0,1: 11,1 $regstatus 0,1 | 4,1 Inregistrat de 8,1 $reguser 7,1 La data de 0,1 :8,1 $regdate 0,1 | 7,1 Obiectii 0,1: 4,1 $regobj 0,1 | 8,1 Comentarii 0,1 : 4,1 $regcomment2 0,1| 4,1 URL 0,1: 11,1 $regurl "
        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"}
                        "&egrave;" {append y "%E8"}
                        "î" {append y "%CE"}
                        "É" {append y "%E9"}
                        "&Egrave;" {append y "%E8"}
                        "Î" {append y "%CE"}
                        "&" {append y "%26"}
                        "#" {append y "%23"}
                        " " {append y "+"}
                        default {append y [string index $x $i]}
                }
        }
        return $y
}


#################################################################################


putlog " * CsC From MasT3r ENABLE *."
MasT3r is offline   Reply With Quote