egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Tcl error [url:check]: Unknown channel setting

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
whiteshark
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: netherlands

PostPosted: Mon May 08, 2006 4:29 pm    Post subject: Tcl error [url:check]: Unknown channel setting Reply with quote

Help me

Code:
#######################################################
### PIC-Check-SCRIPT ###################################
######################################################

proc url:check {nick host hand chan arg} {

    if {[lsearch -exact [channel info $chan] +urlcheck] < 0} { return }
    if {[string match "*www.*.jpg*" [strlwr $arg]] || [string match "*www.*.gif*" [strlwr $arg]] || [string match "*http://*.jpg*" [strlwr $arg]] || [string match "*http://*.gif*" [strlwr $arg]]} {
        url:check:geturl $nick $chan $arg
    }
}

proc url:check:geturl {nick chan arg} {

    foreach word [split $arg " "] {

        if {[string match "*www.*.jpg*" [strlwr $word]] || [string match "*www.*.gif*" [strlwr $word]] || [string match "*http://*.jpg*" [strlwr $word]] || [string match "*http://*.gif*" [strlwr $word]]} {

            putlog "Checke $word von $nick in $chan"
            url:check:imgscan $nick $chan $word

        }
    }
}

proc url:check:imgscan {nick chan arg} {
    global image

    set script 0

    regsub -all "http://" $arg {} url

    set server [lindex [split $url /] 0]
    set url [string replace $url 0 [string first / $url]]

    set query "http://$server/$url"
    set agent "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)"

    http::config -useragent $agent
    set token [http::geturl $query -timeout 10000]

    upvar #0 $token state
    array set meta $state(meta)

    set htmlcode [http::code $token ]
    set htmlmeta [join $state(meta)]

    http::cleanup $token


    if {[string match "HTTP/1.*" $htmlcode] && [string match "*200 OK*" $htmlcode]} {
        set success 1
    } elseif {[string match "HTTP/1.*" $htmlcode] && [string match "*404*" $htmlcode]} {
        url:saytext $nick $chan $server $url "Error 404: Datei $server/$url nicht gefunden!"
        return
    } elseif {[string match "HTTP/1.*" $htmlcode] && [string match "*401*" $htmlcode]} {
        url:saytext $nick $chan $server $url "Error 401: Access to $url denied on $server"
        return
    } elseif {[string match "HTTP/1.*" $htmlcode] && [string match "*302*" $htmlcode]} {
        set moved 1
    } elseif {[string match "HTTP/1*" $htmlcode]} {
        url:saytext $nick $chan $server $url "Server returned code"
    }

    if {[string match "*Location *" $htmlmeta] && [info exists moved]} {
        url:saytext $nick $chan $server $url "Server reports URL to you of $nick one shifted! New URL: [lindex $htmlmeta [expr [lsearch $htmlmeta "Location"] + 1]]"
        return
    }
    if {[string match "*Content-Type text/html*" $htmlmeta] && [info exists success]} {
        url:saytext $nick $chan $server $url "Server reports that the URL from Statuscode \"200 OK\" from $nick's URL, but HTML does not report an image. Possible Virus!"
        return
    }
    if {[string match "*Content-Type image/*" $htmlmeta] && [info exists success]} {
        set image($chan) 1
    }
    if {[string match "*<script*" $htmlmeta] && [info exists image]} {
        set script 1
        url:saytext $nick $chan $server $url "Server reports web page from $nick with Scripts. Possible Virus!"
    }

    url:end $nick $chan $server $url $script

}

proc url:end {nick chan server url script} {
    global image


    if {[info exists image($chan)] && $script == 0} {
        url:saytext $nick $chan $server $url "URL from $nick is safe (No Danger!)"
        unset image($chan)
    }
}

proc url:saytext {nick chan server url text} {

    set chanifo [getchanmode $chan]
    set chanifo1 [string first c $chanifo]

    set line [url:getskin $chan $text]

    if {[onchan $::botnick $chan] && [validchan $chan]} {
        if {$chanifo1 < 0} {
            puthelp "PRIVMSG $chan :$line"
        } elseif {$chanifo1 >= 0 && [string first "" $line] < 0} {
            puthelp "PRIVMSG $chan :$line"
        } else {
            puthelp "PRIVMSG $chan :» URL-Check »» $text «"
        }
    } else {

        putlog "\[url:saytext\] With $chan tunes which not!"

    }

}

proc url:getskin {chan text} {

    set skin($chan)         [channel get $chan fun_style]

    if {$skin($chan) == ""} {

        channel set $chan fun_style 1
        set skin($chan)    1

    }

    set getskin ""

    if {$skin($chan) == 1} {
        set getskin "1,0 » 2URL-Check1 »» $text « "
    } elseif {$skin($chan) == "own"} {
        set getskin [channel get $chan fun_style_own]

    }

    if {$getskin == ""} {
        channel set $chan fun_style 1
        set getskin "1,0 » 2URL-Check1 »» $text « "
    }

    regsub -all {:text:} $getskin "$text" getskin

    return [join $getskin]

}


when i typ this on channel http://www.xs4all.nl/~rschippe/oops.jpg
this error [23:01] Checke http://www.xs4all.nl/~rschippe/oops.jpg von BB4E^WhiteShark in #trivia.nl
[23:01] Tcl error [url:check]: Unknown channel setting


Last edited by whiteshark on Thu May 18, 2006 1:20 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
GeeX
Voice


Joined: 19 Sep 2005
Posts: 29

PostPosted: Mon May 08, 2006 4:54 pm    Post subject: Reply with quote

Error Msg?! Question
Back to top
View user's profile Send private message
whiteshark
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: netherlands

PostPosted: Mon May 08, 2006 5:10 pm    Post subject: Reply with quote

this error on partyline
Tcl error [urlcheck]: can't read "url": no such variable

the { and the } not good placed? i think
Back to top
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon May 08, 2006 8:53 pm    Post subject: Reply with quote

@amstelbier: Posts with poor subject lines may be deleted

More descriptive topics make for better undertsanding of problem(s).
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue May 09, 2006 11:00 am    Post subject: Reply with quote

amstelbier wrote:
this error on partyline
Tcl error [urlcheck]: can't read "url": no such variable

Get the full error message with backtrace, code snipes and line numbers from $errorInfo: Help us to help you
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
whiteshark
Halfop


Joined: 12 Jun 2005
Posts: 62
Location: netherlands

PostPosted: Thu May 18, 2006 1:24 pm    Post subject: Reply with quote

when i typ this on channel http://www.xs4all.nl/~rschippe/oops.jpg
this error [23:01] Checke http://www.xs4all.nl/~rschippe/oops.jpg von BB4E^WhiteShark in #trivia.nl
[23:01] Tcl error [url:check]: Unknown channel setting

i have set .chanset #trivia.nl +urlcheck
but no response on http://www.xs4all.nl/~rschippe/oops.jpg
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber