Thread: [Request script] csc tcl
View Single Post
Old 07-02-2006, 14:08   #3 (permalink)
caesar
Member
 
caesar's Avatar
 
Join Date: Dec 2004
Location: Under a rock!
Posts: 116
Rep Power: 33
caesar will become famous soon enough
Default

Code:
namespace eval csc {
  package require Tcl 8.3
  package require eggdrop 1.6
  package require http
  variable version "0.1"

  bind pub n .csc [namespace current]::pub

  proc pub {nick uhost hand chan text} {
    if {![llength [set check [lindex [split $text] 0]]]} {
      putserv "PRIVMSG $chan :Usage: !csc <channel>"
      return
    }

    set url "http://cservice.undernet.org/live/check_app.php?name=$check"
    set result [read $url]
    putserv "PRIVMSG $chan :$result"
  }

  proc read {url} {
    set token [::http::geturl $url]
    set content [::http::data $token]
    ::http::cleanup $content

    regsub -all {<[^>]*>} $content { } content

    foreach line [split $content \n] {
      if {![llength $line] || [string match "*CService*" $line]} continue
      set message $line
      break
    }

    if {![info exists message]} {
      upvar #0 $token state
      foreach {name value} $state(meta) {
        if {![regexp -nocase ^location$ $name]} continue
        set url "http://cservice.undernet.org/live/$value"
        break
      }
      redirect $url
      } else {
      return $message
    }
  }

  proc redirect {url} {
    set token [::http::geturl $url]
    set content [::http::data $token]
    ::http::cleanup $content

    set top "<table border=0 cellspacing=0 cellpadding=3>"
    set bottom "<script language=\"JavaScript1.2\">"
    set tosave [string range $content [set f [string first $top $content]] [string first $bottom $content $f]] 

    regsub -all {<[^>]*>} $tosave {} tosave

    foreach line [split $tosave \n] {
      putlog $line
    }

  }

  putlog "csc.tcl v$version loaded"
}
M-am plictisit si nu mai am chef... Face-ti voi mai departe. Exemple:
Quote:
[13:01:29] (oaie): [13:01] Channel :&nbsp;#write
[13:01:29] (oaie): [13:01] Posted on :&nbsp;Jan 30 2006 14:58:54 CSST
[13:01:29] (oaie): [13:01] by user :&nbsp;BuRu
[13:01:29] (oaie): [13:01] Current status :&nbsp;Accepted
[13:01:29] (oaie): [13:01] Description :&nbsp;This is a channel for me and my friends . We liky to write and i want to surprise them by meaking a channel . we hope to become write`s . thank you cservice . (my english is bad :&gt; )
[13:01:29] (oaie): [13:01] Decision date :&nbsp;Feb 07 2006 03:51:29 CSST
[13:01:29] (oaie): [13:01] Decision comment :&nbsp;by Saralee (CService Admin)
[13:01:29] (oaie): [13:01] Congratulations for your channel registration.Remember, having X isn't a right but a privilege than can be revoked at any point if abuse is done by you or channel ops.Enjoy
[13:01:29] (oaie):
[13:01:29] (oaie): [13:01] <
[13:01:36] (oaie):
[13:01:36] (oaie): [13:01] Channel :&nbsp;#aid
[13:01:36] (oaie): [13:01] Posted on :&nbsp;Feb 06 2006 21:12:12 CSST
[13:01:36] (oaie): [13:01] by user :&nbsp;DarrK
[13:01:36] (oaie): [13:01] Current status :&nbsp;Pending
[13:01:36] (oaie): [13:01] Description :&nbsp;i make this channel with my special friends for all people who are enjoying here and we hope to do a nice atmosfer and we try to help peoples with their problems.
[13:01:36] (oaie): [13:01] Add an Objection for that applicationnote: you can only post ONE objection per channel.
[13:01:36] (oaie):
[13:01:36] (oaie):
[13:01:36] (oaie): [13:01] You must be logged in in order to post objections
[13:01:36] (oaie): [13:01] Click here to log in
[13:01:36] (oaie):
[13:01:36] (oaie):
[13:01:36] (oaie): [13:01] Current Objections
[13:01:36] (oaie): [13:01] no objections for this application
[13:01:36] (oaie):
[13:01:36] (oaie): [13:01] <
[13:19:10] (oaie): [13:19] Channel :&nbsp;#bapti
[13:19:10] (oaie): [13:19] Posted on :&nbsp;Feb 02 2006 13:14:03 CSST
[13:19:10] (oaie): [13:19] by user :&nbsp;leinto87
[13:19:10] (oaie): [13:19] Current status :&nbsp;Pending
[13:19:10] (oaie): [13:19] Description :&nbsp;This channel is for me and my friends
[13:19:10] (oaie): [13:19] Add an Objection for that applicationnote: you can only post ONE objection per channel.
[13:19:10] (oaie):
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] You must be logged in in order to post objections
[13:19:10] (oaie): [13:19] Click here to log in
[13:19:10] (oaie):
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] Current Objections
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] Posted by :&nbsp;PUSTlU
[13:19:10] (oaie): [13:19] On :&nbsp;Feb 03 2006 18:00:27 CSST
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] Comment :This channels is full for bots clones drones and Bncs This channel has have a X and the cservice manager purged this because leinto87 have a multiple users registration leinto87,WaW,Bapti etc. CService if you ar a smart reject this aplication
[13:19:10] (oaie):
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] Posted by :&nbsp;Locker
[13:19:10] (oaie): [13:19] On :&nbsp;Feb 05 2006 14:14:13 CSST
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] Comment :CService Reject this channel . is clonned . They are lammers . Reject
[13:19:10] (oaie):
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] 2 total objections for #bapti.
[13:19:10] (oaie):
[13:19:10] (oaie):
[13:19:10] (oaie): [13:19] <
caesar is offline   Reply With Quote