This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

need help with a news script

Old posts that have not been replied to for several years.
Locked
y
yoyo

need help with a news script

Post by yoyo »

heyas out there.. i have a problem with my news script, i get the error msg: Invalid URI in request
i just have no idea how to fix it. plz help
thx in advance!


#cfg#
set inftrigger ".inf"
set infchans ""
set inflimit "5"
set infnewspostlimit "3"
set infnewspost "1"
set isinfhub "0"
set infleafs ""
#code#

bind msg - $inftrigger msg_inf
bind pub - $inftrigger pub_inf
bind time - "?0 * * * *" infcheck

proc sendinfnews { arg } {
global infleafs
foreach bot [bots] {
if {([lsearch -exact [string tolower $infleafs] [string tolower $bot]] != -1)} {
putbot $bot "inf: $arg"
}}}

proc shrink { calc number string start bl} { return [expr [string first "$string" $bl $start] $calc $number] }

proc html { text } {
regsub -all "ü" $text "ü" text
regsub -all "ö" $text "ö" text
regsub -all "ä" $text "ä" text
regsub -all "Ü" $text "Ü" text
regsub -all "Ö" $text "Ö" text
regsub -all "Ä" $text "Ä" text
regsub -all "ß" $text "ß" text
regsub -all """ $text "\"" text
regsub -all "<" $text "<" text
regsub -all ">" $text ">" text
return $text
}

proc infcheck {nick uhost hand chan arg} {
global infchans infnewspost isinfhub infnewspostlimit
set counter 0
if {$infnewspost == 1 } {
putlog "inf: suche nach neuer newsline"
set inflastnews "none"
if {[file exists inf.hdl]} {
set temp [open "inf.hdl" r]
set inflastnews "[gets $temp]"
if {$inflastnews == ""} { set inflastnews "none" }
close $temp
}
set temp [open "inf.hdl" w+]
if {[catch {set sock [socket www.infernum.com 80] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET misc/newsyoyo HTTP/1.1"
puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
puts $sock "Host: www.infernum.com"
puts $sock "Connection: close"
puts $sock ""
flush $sock
set counter 0
while {[eof $sock] != 1} {
set bl [gets $sock]
if {[string first "misc/" $bl] != -1} {
set newsline $bl
puts $temp "[html $bl]"
}}}
close $sock ; close $temp
if {$inflastnews == "none" } { putlog "inf: headlinefile created" ; return 0 }
set temp [open "inf.hdl" r]
while { [eof $temp] != 1 } {
set infneunews [gets $temp]
if {($inflastnews == $infneunews) || ($counter == $infnewspostlimit)} { close $temp;return 0 }
incr counter
foreach chan [channels] {
if {$infchans == "" } { putserv "privmsg $chan :(neue infernum newsline) $infneunews" }
if {$infchans != "" } {
if {([lsearch -exact [string tolower $infchans] [string tolower $chan]] != -1) || ($infchans == "")} {putserv "privmsg $chan :(neue inf newsline) $infneunews"}
}
if { $isinfhub == "1" } { sendinfnews $infneunews }
}}}}


proc infnews {target limit} {
if {[catch {set sock [socket www.infernum.com 80] } sockerror]} {
putlog "error: $sockerror"
return 0 } else {
puts $sock "GET misc/newsyoyo HTTP/1.1"
puts $sock "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
puts $sock "Host: www.infernum.com"
puts $sock "Connection: Close"
puts $sock ""
flush $sock
set counter 0
while {[eof $sock] != 1} {
set bl [gets $sock]
if {[string first "misc/" $bl] != -1} {
putserv "privmsg $target :[incr counter] [html $bl]"
}
if {$counter == $limit} {close $sock ; return 0 }
}}}

proc msg_inf { nick uhost hand arg } { global inflimit ; infnews $nick $inflimit }
proc pub_inf { nick uhost hand chan arg } { global infchans inflimit ; if {([lsearch -exact [string tolower $infchans] [string tolower $chan]] != -1) || ($infchans == "")} { infnews $nick $inflimit }}
_____________________________________________________________
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

i dont work with sockets at all, but : i think you have to use http://www.infernum.com/ (btw : austrian ? :D)

yer TCL is based on domsens work, am i correct ? give him credits in the header
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Start your uri with a slash.
Have you ever read "The Manual"?
y
yoyo

Post by yoyo »

credits are in. just haven´t post them.

but it still wont work, the url is without http:\\
still the same.. i wont get the script running.
i hate tcl :>
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Your problem is with http, not tcl. Redirect your hate. :wink:
Have you ever read "The Manual"?
y
yoyo

Post by yoyo »

hehe ok sry :>
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Oh..and btw.. in case you didn't understand my post about the uri...This is the uri in your code (the bold part):
puts $sock "GET misc/newsyoyo HTTP/1.1"
Have you ever read "The Manual"?
y
yoyo

Post by yoyo »

already tried it that way..
oh damn have not thought i am that unable :-?
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

repeating...

Post by user »

Add a SLASH in front of your URI. (not URL)
This is what a slash looks like: / (this is a backslash: \)
Have you ever read "The Manual"?
y
yoyo

Post by yoyo »

yoyo wrote:already tried it that way..
that means it also tried it with /
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

yoyo wrote:that means it also tried it with /
okay...but saying stuff like
yoyo wrote:the url is without http:\\
made me think you had no idea that backslash!=slash

Anyway...that uri (/misc/newsyoyo) is valid, so at least you should get a different error message than "Invalid URI in request"
Have you ever read "The Manual"?
Locked