I have been trying to simply read a text file hosted online, parse it and select data from it and return it in a message to the user who activated the trigger. The code is so far this, and it doesnt get passed the "on to the next proc" log message; and it doesnt give an error either. The text file is also not a .txt but a .ical file, but it can be opened as a txt file. I also took most of the code from this thread: http://forum.egghelp.org/viewtopic.php? ... t=txt+file so cheers to gb for that.
Here is the code
Code: Select all
# Set the chans you want to enable it in to +news
# .chanset #channel +news
# set this to the URL of the news file
set newsfile "http://www.enemydown.co.uk/files/calendar.php?clan=18931"
# want the answer to come out in notice (0) or privmsg (1)?
set tellwho 0
if ![info exists egghttp(version)] {
putlog "egghttp.tcl was NOT successfully loaded."
return
}
bind pub - !news getlist
proc getlist {nick uhost hand chan text} {
# if ![channel get $chan news] return
global newsfile
set sock [egghttp:geturl $newsfile [list processlist $nick]]
putlog "on to the next proc"
}
proc processlist {nick sock} {
global tellwho
set todaysdate strftime %Y%m%d
set data [egghttp:headers $sock]
foreach line [split $data \n] {
set start [string first "$todaysmatch" $line]
set start [expr {$start - 45}]
set end [string first "$todaysmatch*STATUS" $line]
set end [expr {$end - 1}]
set served [string range $line $start $end]
putlog "$line"
putlog "$served"
if $tellwho {
putserv "NOTICE $nick :$line"
} {
putserv "PRIVMSG $nick :$line"
}
}
if [string match -no Content-Type:* $line] { putlog "Its reached the end bit"}
}
Thanks in advance for any help
