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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Kimmi
Halfop
Posts: 58 Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:
Post
by Kimmi » Mon Aug 07, 2006 7:04 am
Hello
I have been looking for a script that does a "screen" on a irc channel and makes a html file, including all users on channel and all chat and actions.
I tryed a script called irc2html.tcl, but its 8 years old and didnt support current eggdrop version.
Anyone that know of a newer version of this script?
Kimmi@EFnet
Kimmi
Halfop
Posts: 58 Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:
Post
by Kimmi » Mon Aug 07, 2006 7:20 am
Code: Select all
set buf {}
set maxlines 5 ;# lines
set refresh 30 ;# seconds
bind pubm - "#channel *" foo
proc foo {n u h c t} {
if {[llength $::buf] == $::maxlines} {
set ::buf [lreplace $::buf 0 0]
}
lappend ::buf [list $n $t]
}
proc bar {sec} {
if ![catch {set fd [open /path/to/convo.html w]}] {
puts $fd "<html><head><title>some title</title>"
puts $fd "<meta http-equiv=\"refresh\" content=\"$sec\">"
puts $fd "</head><body>"
foreach e $::buf {
puts $fd "<[lindex $e 0]> [lindex $e 1]<br>"
}
puts $fd "</body></html>"
close $fd
}
utimer $sec [list bar $sec]
}
bar $refresh
okey I got this code and it looks like this:
http://eggis.multinet.no/~lisemarie/haua.html
Is it hard to add who is saying what... like add the nick
and to make a list of all users in channel ?
Kimmi@EFnet
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Mon Aug 07, 2006 7:33 pm
Rude
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Mon Aug 07, 2006 7:37 pm
Try this:
* code updated with nml375's improvement *
Code: Select all
set 12h(chan) "#yourchannel"; channel to log
set i2h(maxlines) "5"; # no of lines
set i2h(refresh) "30"; # no of seconds
set i2h(buffer) ""; # the buffer, dont touch
set i2h(file) "/path/to/html/file"; # the html file
if {![file exists $::i2h(file)]} {
set file [open $::i2h(file) w]; puts $file ""; close $file
}
bind pubm - "$::i2h(chan) *" i2h:log
proc i2h:log {nickname hostname handle channel text} {
if {[llength $::i2h(buffer)] >= $::i2h(maxlines)} {
set ::i2h(buffer) ""
}
lappend ::i2h(buffer) "$nickname $text"
}
proc i2h:update {} {
if {[catch { set file [open $::i2h(file) w] } err]} {
putlog "i2h file error: $err"
} else {
puts $file "<html><head><title>some title</title>"
puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">"
puts $file "</head><body>"
foreach i $::i2h(buffer) {
puts $file "<[lindex [split $i] 0]> [lrange $i 1 end]<br>"
}
puts $file "</body></html>"
}
utimer $::i2h(refresh) [list i2h:update]
}
i2h:update
putlog "i2h (irc2html) loaded"
Not tested, but hopefully it should work
Last edited by
r0t3n on Mon Aug 07, 2006 7:58 pm, edited 2 times in total.
r0t3n @ #r0t3n @ Quakenet
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Mon Aug 07, 2006 7:47 pm
Might be a good idea to escape <> around nicks, to that they're not mistaken for tags.. ie:
Code: Select all
...
puts $file "<[lindex $e 0]> [lindex $e 1]<br>"
...
rather than
Code: Select all
...
puts $file "<[lindex $e 0]> [lindex $e 1]<br>"
...
Would make one confused browser otherwize...
edit: Minor typo...
NML_375
Kimmi
Halfop
Posts: 58 Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:
Post
by Kimmi » Tue Aug 08, 2006 8:28 am
thanx guys!
But I do get an error on line 11
Code: Select all
bind pubm - "$::i2h(chan) *" i2h:log
[13:26] can't read "::i2h(chan)": no such element in array
while executing
"bind pubm - "$::i2h(chan) *" i2h:log"
(file "scripts/html2.tcl" line 11)
invoked from within
"source scripts/html2.tcl
"
#FIXED# IT WAS A TYPO
Kimmi@EFnet
Kimmi
Halfop
Posts: 58 Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:
Post
by Kimmi » Tue Aug 08, 2006 8:34 am
okey...
[13:29] can't read "sec": no such variable
while executing
"puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">""
(procedure "i2h:update" line 6)
invoked from within
"i2h:update"
(file "scripts/html2.tcl" line 35)
invoked from within
"source scripts/html2.tcl
"
It kinda looks like I need to set $sec as a time variable, how does one do that ?
Kimmi@EFnet
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Tue Aug 08, 2006 9:34 am
change
Code: Select all
puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">"
to
Code: Select all
puts $file "<meta http-equiv=\"refresh\" content=\"$::i2h(refresh)\">"
r0t3n @ #r0t3n @ Quakenet
Kimmi
Halfop
Posts: 58 Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:
Post
by Kimmi » Tue Aug 08, 2006 2:05 pm
okey, now the script starts and I get "i2h (irc2html) loaded"
but, now it dont print anything to file....
like haua.html is empty, something must be changes, cuz the initial code on the top, worked. only nick wasnt showing there.
Kimmi@EFnet
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Tue Aug 08, 2006 2:17 pm
Seems like the updated script does'nt close the file at the end of the update... Would be my first bet..
As for your initial script, it did indeed print out nickname.. you just accidentally turned it into an (invalid) html-tag (check the source of the page you linked earlier)
NML_375
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Tue Aug 08, 2006 2:29 pm
*UPDATED* (not tested)
Code: Select all
set 12h(chan) "#yourchannel"; channel to log
set i2h(maxlines) "5"; # no of lines
set i2h(refresh) "30"; # no of seconds
set i2h(buffer) ""; # the buffer, dont touch
set i2h(file) "/path/to/html/file.html"; # the html file
if {![file exists $::i2h(file)]} {
set file [open $::i2h(file) w]; puts $file ""; close $file
}
bind pubm - "$::i2h(chan) *" i2h:log
proc i2h:log {nickname hostname handle channel text} {
if {[llength $::i2h(buffer)] >= $::i2h(maxlines)} {
set ::i2h(buffer) ""
}
lappend ::i2h(buffer) "$nickname $text"
}
proc i2h:update {} {
if {[catch { set file [open $::i2h(file) w] } err]} {
putlog "i2h file error: $err"
} else {
puts $file "<html><head><title>some title</title>"
puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">"
puts $file "</head><body>"
foreach i $::i2h(buffer) {
puts $file "<[lindex [split $i] 0]> [lrange $i 1 end]<br>"
}
puts $file "</body></html>"
close $file
}
utimer $::i2h(refresh) [list i2h:update]
}
i2h:update
putlog "i2h (irc2html) loaded. Logging $::i2h(chan) to [lindex [split $::i2h(file) /] end]."
r0t3n @ #r0t3n @ Quakenet
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Tue Aug 08, 2006 5:54 pm
What's the use of resetting the var (to nothing) after 5 lines when it's only flushed to the file every 30 seconds.
That basically only allows (the last) 5 lines that are said to be in the file, not much of a "irc2html" then.
Kimmi
Halfop
Posts: 58 Joined: Thu Jul 24, 2003 4:17 pm
Location: Norway
Contact:
Post
by Kimmi » Tue Aug 08, 2006 7:13 pm
Tosser^^ tywm it worked!! few bugs but sorted that out...
and
I see what you meen metroid, how do I make it only remove the last line and not reset the hole, when it gets to the "max line number I have set"
but, is it easy to implement a list of showing all people on the channel, and topic ?
Kimmi@EFnet