Code: Select all
set ver "1.00"
set i2h_history [list]
bind ctcp - ACTION ctcp:i2h
bind join - * join:i2h
bind kick - * kick:i2h
if {[string range $version 2 1] < 1030000} {
bind mode - * mode11x:i2h
} else {
bind mode - * mode13x:i2h
}
bind nick - * nick:i2h
bind part - * part:i2h
bind pubm - * pubm:i2h
bind sign - * sign:i2h
bind topc - * topc:i2h
proc i2h:make {} {
global i2h_history i2h_htmlfile i2h_maxlines i2h_chan i2h_text i2h_bgcolor i2h_heading i2h_refresh i2h_font i2h_title server
if {[llength $i2h_history] > $i2h_maxlines} { set i2h_history [lrange $i2h_history 1 end] }
set i2h_file [open $i2h_htmlfile w]
puts $i2h_file "<HTML>\n<HEAD>\n <TITLE>$i2h_title</TITLE>\n <META HTTP-EQUIV=\"Refresh\" CONTENT=\"$i2h_refresh\">\n</HEAD>"
puts $i2h_file "<BODY TEXT=\"$i2h_text\" BGCOLOR=\"$i2h_bgcolor\" LINK=\"$i2h_heading\" VLINK=\"$i2h_heading\">"
puts $i2h_file " <FONT SIZE=\"+1\" COLOR=\"$i2h_heading\" FACE=\"Tahoma, Sans-serif\">$i2h_chan<FONT SIZE=\"-1\" FACE=\"Monospace\"> \[[lindex [getchanmode $i2h_chan] 0]\]: '[i2h:convert [topic $i2h_chan]]'</FONT></FONT><P>"
puts $i2h_file " <FONT SIZE=\"-1\" FACE=\"$i2h_font\">"
puts $i2h_file " <B>Server.</B>: [string range $server 0 [expr [string last ":" $server] - 1]]<BR>"
puts $i2h_file " <B>Users..</B>: [lrange [chanlist $i2h_chan] 0 end] \[[llength [chanlist $i2h_chan]]\]<BR>\n <HR SIZE=\"1\">"
close $i2h_file
set i2h_file [open $i2h_htmlfile a]
for {set i 0} {$i < [llength $i2h_history]} { incr i } {
puts $i2h_file " [lindex $i2h_history $i]<BR>"
}
puts $i2h_file " </FONT>\n <HR SIZE=\"1\">\n <CENTER><FONT SIZE=\"-1\" FACE=\"Sans-serif\"><I>Powered by <A HREF=\"http://www.projectx.mx.dk/\">ProjectX</A> irc2html by <A HREF=\"mailto:natrak@projectx.mx.dk\">Natrak</A></I></FONT></CENTER>\n</BODY>\n</HTML>"
close $i2h_file
return 1
}
proc i2h:convert {i2h_text} {
#Strip control codes.. sorta
regsub -all $i2h_text "" i2h_text
regsub -all $i2h_text "" i2h_text
regsub -all $i2h_text "" i2h_text
regsub -all $i2h_text "" i2h_text
regsub -all $i2h_text "" i2h_text
#Convert special chars
regsub -all & $i2h_text "\\&" i2h_text
regsub -all \" $i2h_text "\\"" i2h_text
regsub -all < $i2h_text "\\<" i2h_text
regsub -all > $i2h_text "\\>" i2h_text
regsub -all " " $i2h_text " \\ " i2h_text
return $i2h_text
}
proc ctcp:i2h {nick host handle dest keyword arg} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $dest] [string tolower $i2h_chan]] && ![string compare $keyword "ACTION"]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] * $nick [i2h:convert $arg]"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] ð $nick [i2h:convert $arg]"]
}
}
utimer 1 i2h:make
}
proc join:i2h {nick host handle chan} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick ($host) has joined $chan"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- $nick \[$host\] has joined $chan"]
}
}
i2h:make
}
proc kick:i2h {nick host handle chan knick arg} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $knick was kicked by $nick ([i2h:convert $arg])"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- $knick was kicked off $chan by $nick ([i2h:convert $arg])"]
}
}
utimer 1 i2h:make
}
proc mode11x:i2h {nick host handle chan arg} {
global i2h_history i2h_chan i2h_style
if {[lindex $arg 0] == "+k"} {
set mode [lindex $arg 0]
} else {
set mode [lrange $arg 0 end]
}
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick sets mode: $mode"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- mode/$chan \[$mode\] by user $nick"]
}
}
utimer 1 i2h:make
}
proc mode13x:i2h {nick host handle chan arg mnick} {
global i2h_history i2h_chan i2h_style
if {[lindex $arg 0] == "+k"} {
set mode [lindex $arg 0] $mnick
} else {
set mode [lrange $arg 0 end]
}
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick sets mode: $mode"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- mode/$chan \[$mode\] by user $nick"]
}
}
utimer 1 i2h:make
}
proc nick:i2h {nick host handle chan newnick} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick is now known as $newnick"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- $nick is now known as $newnick"]
}
}
utimer 1 i2h:make
}
proc part:i2h {nick host handle chan} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick ($host) has left $chan"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- $nick has left $chan"]
}
}
utimer 1 i2h:make
}
proc pubm:i2h {nick host handle chan arg} {
global i2h_history i2h_chan i2h_secret
if {![string compare [string tolower $chan] [string tolower $i2h_chan]] && [string range $arg 0 0] != $i2h_secret} {
set i2h_history [lappend i2h_history "\[[time]\] <$nick> [i2h:convert $arg]"]
}
i2h:make
}
proc sign:i2h {nick host handle chan arg} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $chan] [string tolower $i2h_chan]]} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick ($host) has quit irc ([i2h:convert $arg])"]
} else {s
set i2h_history [lappend i2h_history "\[[time]\] -o- $nick \[$host\] quit ([i2h:convert $arg])"]
}
}
utimer 1 i2h:make
}
proc topc:i2h {nick host handle chan topic} {
global i2h_history i2h_chan i2h_style
if {![string compare [string tolower $chan] [string tolower $i2h_chan]] && $nick != "*"} {
if {$i2h_style} {
set i2h_history [lappend i2h_history "\[[time]\] *** $nick changes topic to '[i2h:convert $topic]'"]
} else {
set i2h_history [lappend i2h_history "\[[time]\] -o- $nick changes topic on $chan to '[i2h:convert $topic]'"]
}
}
utimer 1 i2h:make
}
set i2h_file [open $i2h_htmlfile w]
puts $i2h_file "<HTML>\n<HEAD>\n <TITLE>$i2h_title</TITLE>\n <META HTTP-EQUIV=\"Refresh\" CONTENT=\"$i2h_refresh\">\n</HEAD>"
puts $i2h_file "<BODY TEXT=\"$i2h_text\" BGCOLOR=\"$i2h_bgcolor\" LINK=\"$i2h_heading\" VLINK=\"$i2h_heading\">"
puts $i2h_file " <FONT SIZE=\"+1\" COLOR=\"$i2h_heading\" FACE=\"Tahoma, Sans-serif\">$i2h_chan<FONT SIZE=\"-1\" FACE=\"Monospace\"> \[\]: ''</FONT></FONT><P>"
puts $i2h_file " <FONT SIZE=\"-1\" FACE=\"${i2h_font}\">"
puts $i2h_file " <B>Server.</B>: unknown<BR>"
puts $i2h_file " <B>Users..</B>: unknown<BR>\n <HR SIZE=\"1\">"
puts $i2h_file " </FONT>\n <HR SIZE=\"1\">\n <CENTER><FONT SIZE=\"-1\" FACE=\"Sans-serif\"><I>Powered by <A HREF=\"http://www.projectx.mx.dk/\">ProjectX</A> irc2html by <A HREF=\"mailto:natrak@projectx.mx.dk\">Natrak</A></I></FONT></CENTER>\n</BODY>\n</HTML>"
close $i2h_file
utimer 2 i2h:make
putlog "\[ProjectX\] irc2html v$ver by Natrak <natrak@projectx.mx.dk> loaded."
Code: Select all
if {[string range $version 2 1] < 1030000} {
bind mode - * mode11x:i2h
} else {
bind mode - * mode13x:i2h
}
Code: Select all
if {$numversion < 1030000} {
bind mode - * mode11x:i2h
} else {
bind mode - * mode13x:i2h
}
Code: Select all
set mode [lindex $arg 0] $mnick
Code: Select all
set mode "[lindex $arg 0] $mnick"
Code: Select all
set i2h_history [lappend i2h_history "\[[time]\] *** $nick sets mode: $mode"]
Code: Select all
set i2h_history [lappend i2h_history "\[[time]\] *** $nick sets mode: $mode $mnick"]
Code: Select all
proc part:i2h {nick host handle chan} {
Code: Select all
proc part:i2h {nick host handle chan arg} {
Code: Select all
proc part:i2h {nick host handle chan {arg ""}} {
Code: Select all
proc mode13x:i2h {nick host handle chan arg mnick} {
global i2h_history i2h_chan i2h_style
if {[lindex $arg 0] == "+k"} {
set mode [lindex $arg 0] $mnick
} else {
set mode [lrange $arg 0 end]
}
Code: Select all
proc mode13x:i2h {nick host handle chan arg mnick} {
global i2h_history i2h_chan i2h_style
set mode "$arg $mnick"