<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16143" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2008-09-13T19:33:59-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16143</id>

		<entry>
		<author><name><![CDATA[Wuff]]></name></author>
		<updated>2008-09-13T19:33:59-04:00</updated>

		<published>2008-09-13T19:33:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85153#p85153</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85153#p85153"/>
		<title type="html"><![CDATA[Using foreing chars (ÆØÅ) in Eggdrop/TCL scripts?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85153#p85153"><![CDATA[
Ah okey.. now I get it.. Thanks mate! I'll try it out<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9361">Wuff</a> — Sat Sep 13, 2008 7:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-09-13T19:27:02-04:00</updated>

		<published>2008-09-13T19:27:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85152#p85152</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85152#p85152"/>
		<title type="html"><![CDATA[Using foreing chars (ÆØÅ) in Eggdrop/TCL scripts?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85152#p85152"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>[open &lt;file&gt; a][open &lt;file&gt; w]</code></pre></div>Everytime you see one of these, it wants to open the file and write to it. W overwrites anything prior, A appends. It is after these commands you want to use  [fconfigure &lt;file&gt; -encdoing binary] immediately afterwards, adding this line into the script itself. You may also need to do this for the read's as well, the [open &lt;file&gt; r].<br><br>for example <div class="codebox"><p>Code: </p><pre><code>change this:set create_init [open ${statsdir}${melinitfile} a]to look like this:fconfigure [set create_init [open ${statsdir}${melinitfile} a]] -encoding binary</code></pre></div>Simply change every occurence of a W or A as such.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Sep 13, 2008 7:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Wuff]]></name></author>
		<updated>2008-09-13T19:12:23-04:00</updated>

		<published>2008-09-13T19:12:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85151#p85151</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85151#p85151"/>
		<title type="html"><![CDATA[Using foreing chars (ÆØÅ) in Eggdrop/TCL scripts?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85151#p85151"><![CDATA[
I'd like to say it helped me, but it didn't. Thanks for trying tho :/ I'm afraid it's a little out of my league to fully understand.<br><br>Could someone elaborate it abit, maybe direct me to an example where it has been used? I'm not even sure what to do with that command, do I run it on my shell, or through a script? Sorry for my ignorance, but I don't know where else to turn.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9361">Wuff</a> — Sat Sep 13, 2008 7:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2008-09-13T12:55:40-04:00</updated>

		<published>2008-09-13T12:55:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85145#p85145</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85145#p85145"/>
		<title type="html"><![CDATA[Using foreing chars (ÆØÅ) in Eggdrop/TCL scripts?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85145#p85145"><![CDATA[
The problem has been mentioned on this forum, it is caused by eggdrop. You need to investigate the <a href="http://www.tcl.tk/man/tcl8.2.3/TclCmd/fconfigure.htm#M8" class="postlink"><strong class="text-strong">[fconfigure $file -encdoing binary]</strong></a> command, and use this after you open the file. Otherwise everytime you write to that file the flaw within eggdrop will mangle whatever you add. Your encodings are your problem.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Sep 13, 2008 12:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Wuff]]></name></author>
		<updated>2008-09-13T11:16:43-04:00</updated>

		<published>2008-09-13T11:16:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85144#p85144</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85144#p85144"/>
		<title type="html"><![CDATA[Using foreing chars (ÆØÅ) in Eggdrop/TCL scripts?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85144#p85144"><![CDATA[
Hi<br><br>I'm using a script to keep a log from my channel. I'm using the log to make channel statistics. <br><br>When the script logs the channel, it is messing up "æøå". So that "Æ" for instances looks like "Ã¦". <br>I'm not sure if it is the script, eggdrop og even my Linux distribution in general that needs to be modifed, to make it log the chars correctly!?<br><br>I have tried searching this forum, and have google for hours, without finding anything that resembles issues with ÆØÅ in Eggdrop or tcl scripts.<br><br>Do I need to modify my script? If so, could anyone be of assistance please! Or is it some sort of variable I have to set corretly in my Eggdrop og Linux?<br><br>Here is the code I'm using...:<br><br><div class="codebox"><p>Code: </p><pre><code>#### mIRCStats Eggdrop Logger by Jules &lt;jules@angelbears.org&gt; #manchester@IRCNet#### Multiple Channel Support by SirSir &lt;sirsir@thuntek.net&gt;#### Unix/Linux Support by T_D &lt;todd6971@msn.com&gt; #cracks2000@EFNet######## This tcl creates mIRC-style channel logfiles for use with the popular#### mIRCStats &lt;http://gamma.nic.fi/~mauvinen/mircstats/&gt; program.#### This tcl will ONLY run on eggdrop1.6.0 or higher!!!######## For version history see history.txt#### Set your mel directories here. set statsdir "mel/"set statslogdir "mel/logs/"#### Set this to your handle on the bot. You will be UNABLE to use any of#### the partyline commands if this is set incorrectly!!!set logkeeper "Jules"#### Select if you want filenames without a leading #. 1 is without #, 0 is with #.set usenix 0#### Select if you want a datestamp in the filenames. 1 is yes, 0 is no.#### Datestamped filenames are like #channel.03.25.2001.log#### This value can be ignored when running in mAC mode.set dslogfiles 1#### Select if you are upgrading from mEL version 1.5.3 or lower.set upgrade 0# # # # # # # # # # # # DO NOT CHANGE ANYTHING BELOW HERE # # # # # # # # # # #set logver "v1.5.5"set vername "\002mEL $logver:\002"set todaydate [strftime %j:%Y]set switch 1set switched 0set daysamount 7set melinitfile "init.mel"set daysfile "switch.mel"set removedchannels "rmchans.mel"set macfile "checkmac.mel"set setdaysfile "setdays.mel"set started "iunno..."set mel_chanid 0set mel_keepid 0bind dcc * mel mel_dccbind pubm - * mel_chatterbind join - * mel_enterbind sign - * mel_signoffbind topc - * mel_ctopicbind kick - * mel_kickedbind nick - * mel_nickchangebind mode - * mel_cmodebind part - * mel_partingabind ctcp - "ACTION" mel_cactionif {![file isdirectory $statsdir]} {putlog "$vername Settings directory not found... creating..."[file mkdir $statsdir]}if {![file isdirectory $statslogdir]} {putlog "$vername Logfile directory not found... creating..."[file mkdir $statslogdir]}#### End_globvarstat_a#### Start_procdccproc mel_dcc {handle idx arg} {global logkeeper upgrade started daysamount statsdir statslogdir logver autoswitch switch vername mel_chans mel_chanid statsdir macfile setdaysfile daysfile todaydmy nextswitch mel_keepid mel_keepers macmodeset arg1 [lindex $arg 0]set arg2 [lindex $arg 1]if {![finditem fkeep [string tolower $handle]]} {putlog "#$handle# mel $arg"putidx $idx "You are not allowed to perform maintenance!"putidx $idx "Contact $logkeeper for more information"putidx $idx "\002mIRCStats Eggdrop Logger\002 $logver"return 0}switch -- $arg1 { on {putlog "#$handle# mel on"if {$switch == 1} {putidx $idx "$vername mEL is already turned on!"return 0}if {![array exists mel_chans]} {putidx $idx "$vername You must use .mel +chan first!!"return 0}set switch 1putidx $idx "$vername mEL turned on!"return 0} off {putlog "#$handle# mel off"if {$switch == 0} {putidx $idx "$vername mEL is already turned off!"return 0}set switch 0putidx $idx "$vername mEL turned off!"return 0} setdays {putlog "#$handle# mel setdays"if {$switch == 0} {putidx $idx "$vername Can't change amount of days to log -&gt; Logging is disabled!"return 0}if {$arg2 == ""} {putidx $idx "Please enter an amount of days"return 0}if {[string compare [string index $arg2 0] "-"] == 0} {putidx $idx "Negative value detected! Ignoring..."return 0}if {[string compare [string is digit -failindex indexfailed $arg2] 1] != 0} {set failedchar [string index $arg2 $indexfailed]putidx $idx "Error! $failedchar is not a valid digit!"return 0}if {$arg2 == "0"} {if {[checkmacfile]} {putidx $idx "$vername mEL is already running in mAC mode!"return 0}putidx $idx "Switching to mAC mode..."foreach search [binds time] {set procname [lindex $search 4]if {[string compare $procname "meltimer"] == 0} {set binder [lindex $search 2]unbind time - "$binder" meltimerbreak}}set create [open ${statsdir}${macfile} w]puts $create "mAC mode check file - DO NOT REMOVE!!!"close $createset autoswitch 1switchlogsset macmode 1putidx $idx "$vername mEL has switched to mAC mode. Switching back to manual mode will restart logging!"return 0} else {set arg2 [string trimleft $arg2 0]if {![checkmacfile]} {set todaydmy [clock format [unixtime] -format "%d %m %Y"]set nextswitch [clock format [clock scan "today next $arg2 days"] -format "%d %m %Y"]putidx $idx "$vername Changing logging to $arg2 days"if {[file exists ${statsdir}${daysfile}]} {set remove [file delete -force ${statsdir}${daysfile}]}set create [open ${statsdir}${daysfile} w]puts $create "$nextswitch"close $createif {[file exists ${statsdir}${setdaysfile}]} {set remove [file delete -force ${statsdir}${setdaysfile}]}set create [open ${statsdir}${setdaysfile} w]puts $create "$arg2"close $createforeach search [binds time] {set procname [lindex $search 4]if {[string compare $procname "meltimer"] == 0} {set binder [lindex $search 2]unbind time - "$binder" meltimerbreak}}bind time - "* 00 $nextswitch" meltimerputlog "$vername Timer bound to the first second of [lindex $nextswitch 0]/[lindex $nextswitch 1]/[lindex $nextswitch 2]"return 0} else {putidx $idx "$vername Switching back to manual mode..."set todaydmy [clock format [unixtime] -format "%d %m %Y"] set remove [file delete -force ${statsdir}${macfile}]set nextswitch [clock format [clock scan "today next $arg2 days"] -format "%d %m %Y"]if {[file exists ${statsdir}${daysfile}]} {set remove [file delete -force ${statsdir}${daysfile}]}set create [open ${statsdir}${daysfile} w]puts $create "$nextswitch"close $createif {[file exists ${statsdir}${setdaysfile}]} {set remove [file delete -force ${statsdir}${setdaysfile}]}set create [open ${statsdir}${setdaysfile} w]puts $create "$arg2"close $createset autoswitch 1switchlogsputidx $idx "$vername Back in manual mode."foreach search [binds time] {set procname [lindex $search 4]if {[string compare $procname "meltimer"] == 0} {set binder [lindex $search 2]unbind time - "$binder" meltimer}}bind time - "* 00 $nextswitch" meltimerputlog "$vername Timer bound to the first second of [lindex $nextswitch 0]/[lindex $nextswitch 1]/[lindex $nextswitch 2]"set macmode 0return 0}return 0}return 0} status {putlog "#$handle# mel status"if {$switch == 0} {putidx $idx "mEL MUST be turned on first."return 0}readdaysif {[lindex $daysamount 0] == "iunno..."} {set donotswitch 1} else { set donotswitch 0 }set thisday [clock format [unixtime] -format "%d %m %Y"]set status "Off"if {$switch == 1} {set status "On"}putidx $idx "mEL is turned $status"if {[checkmacfile]} {putidx $idx "mEL is running in mAC mode."} else {if {$donotswitch == 1} {putidx $idx "mEL has disabled switching!!! Please use \002.mel setdays\002 to enable switching!!"putidx $idx "mEL is NOT running in mAC mode and mEL is NOT switching logfiles!!!!!"} else {putidx $idx "mEL switches logfiles every $daysamount day(s)."putidx $idx "Next switch is at the first second of [lindex $nextswitch 0]/[lindex $nextswitch 1]/[lindex $nextswitch 2]"putidx $idx "Today is [lindex $thisday 0]/[lindex $thisday 1]/[lindex $thisday 2]"}}foreach m [array names mel_chans] {set data $mel_chans($m)putidx $idx "    Logging $data"}if {$upgrade == 1} {putidx $idx ""putidx $idx "DO NOT FORGET TO SET VARIABLE 'UPGRADE' TO 0!!!!!!!!!"}putidx $idx ""putidx $idx "Storing settings in $statsdir"putidx $idx "Storing logfiles in $statslogdir"return 0} +chan {if {$arg2 != ""} {putlog "#$handle# mel +chan $arg2"if {[string index $arg2 0] != "#"} {putidx $idx "Please use .mel +chan &lt;#channel&gt;"return 0}if {$mel_chanid != 0} {if {[finditem fchan [string tolower $arg2]]} {putidx $idx "$vername $arg2 is already being logged!"return 0}}set temp [additem achan [string tolower $arg2]]putidx $idx "mEL is logging $arg2"return 0}} -chan {if {$arg2 != ""} {putlog "#$handle# mel -chan $arg2"if {[string index $arg2 0] != "#"} {putidx $idx "Please use .mel -chan &lt;#channel&gt;"return 0}if {![array exists mel_chans]} {putidx $idx "$vername You must use .mel +chan &lt;channel&gt; first!"return 0}if {![finditem fchan [string tolower $arg2]]} {putidx $idx "$vername $cmd2 is not being logged!"return 0}set temp [delitem dchan [string tolower $arg2]]putidx $idx "mEL is no longer logging $arg2"putidx $idx "Use .mel erase to remove the logfile!"return 0}} erase {putlog "#$handle# mel erase"killog $handlereturn 0} addkeeper {if {$arg2 != ""} {putlog "#$handle# mel addkeeper $arg2"if {[string tolower $handle] != [string tolower $logkeeper]} {putidx $idx "$vername Sorry, you can't add logkeepers!"return 0}if {![validuser $arg2]} {putidx $idx "$vername This is not a valid handle!"return 0}if {[finditem fkeep [string tolower $arg2]]} {putidx $idx "$vername $arg2 already is a logkeeper!"return 0}set temp [additem akeep [string tolower $arg2]]putidx $idx "$vername User added successfully!"return 0}}rmkeeper {if {$arg2 != ""} {putlog "#$handle# mel rmkeeper $arg2"if {[string tolower $handle] != [string tolower $logkeeper]} {putidx $idx "$vername Sorry, you can't remove logkeepers!"return 0}if {[string tolower $logkeeper] == [string tolower $arg2]} {putidx $idx "$vername Unable to remove static logkeeper!"return 0}if {![finditem fkeep $arg2]} {putidx $idx "$vername $arg2 isn't a logkeeper to begin with!"return 0}set temp [delitem dkeep $arg2]putidx $idx "$vername User removed successfully!"return 0}} listkeeper {putlog "#$handle# mel listkeeper"putidx $idx "The following handles have logkeeper status:"putidx $idx "   $logkeeper"foreach k [array names mel_keepers] {set foundkeeper $mel_keepers($k)if {[string tolower $foundkeeper] != [string tolower $logkeeper]} {putidx $idx "   $foundkeeper"}}return 0}}putidx $idx "\002Usage:\002 .mel &lt;on/off/setdays/status/+chan/-chan/erase/addkeeper/rmkeeper/listkeeper&gt;"return 0}#### End_procdcc#### Start_variousprocsproc checkmacfile {} {global statsdir macfileif {[file exists ${statsdir}${macfile}]} {return 1} else {return 0}}proc checklogrestart {channel} {global statslogdir usenixset chan1 [string tolower $channel]if {$usenix == 1} {set chan [string trimleft $chan1 #]} else { set chan $chan1 }if {![file exists ${statslogdir}${chan}.log]} {createlog $chan}}proc readdays {} {global daysfile nextswitch daysamount setdaysfile statsdirif {[file exists ${statsdir}${daysfile}]} {set read [open ${statsdir}${daysfile} r]while {![eof $read]} {set days [gets $read]if {[eof $read]} {break}set nextswitch $days}close $read}if {[file exists ${statsdir}${setdaysfile}]} {set read [open ${statsdir}${setdaysfile} r]while {![eof $read]} {set days [gets $read]if {[eof $read]} {break}set daysamount $days}close $read}}#### End_variousprocs#### Start_arrayhandlerproc mel_arrayinit {} {global statsdir melinitfile mel_chanid mel_chans mel_keepid mel_keepers switch vernameif {![file exists ${statsdir}${melinitfile}]} {set switch 0return 0}set chansel 0set keepsel 0set nokeeper 0set readin [open ${statsdir}${melinitfile} r]while {![eof $readin]} {set raw_initdata [gets $readin]if {[eof $readin]} {break}if {$chansel == 0} {if {[string compare $raw_initdata "\[channels\]"] == 0} {set chansel 1continue}putlog "$vername No channels identifier found! Initialization failed! Possible corrupt init-file!"return 0} else {if {$keepsel == 0} {if {$chansel == 1} {set allchans 0incr chansel}if {[string compare $raw_initdata "\[keepers\]"] == 0} {set keepsel 1continue}if {$allchans == 0} {unset allchans}lappend allchans $raw_initdatacontinue} else {if {$keepsel == 1} {set allkeepers 0incr keepsel}if {[string compare $raw_initdata "\[end of file\]"] == 0} {break}if {[string compare $raw_initdata "\[ignores\]"] == 0} {putlog "$vername Old init-file detected... removing ignores from init-file..."set nokeeper 1break}if {$allkeepers == 0} {unset allkeepers}if {$nokeeper != 1} {lappend allkeepers $raw_initdata}continue}}}close $readinset mel_chanid 0set mel_keepid 0if {$allchans != 0} {foreach melchans $allchans {incr mel_chanidset mel_chans($mel_chanid) $melchans}} else {set switch 0}if {$allkeepers != 0} {foreach melkeeps $allkeepers {incr mel_keepidset mel_keepers($mel_keepid) $melkeeps}}if {$nokeeper == 1} {write_array}return 0}proc write_array {} {global statsdir melinitfile mel_chanid mel_chans mel_keepid mel_keepersif {[file exists ${statsdir}${melinitfile}]} {set backup_init [file rename -force ${statsdir}${melinitfile} ${statsdir}${melinitfile}.bak]}set put_init [open ${statsdir}${melinitfile} w]puts $put_init "\[channels\]"foreach c [array names mel_chans] {set add_chan $mel_chans($c)puts $put_init $add_chan}puts $put_init "\[keepers\]"foreach k [array names mel_keepers] {set add_keep $mel_keepers($k)puts $put_init $add_keep}puts $put_init "\[end of file\]"close $put_initmel_arrayinitreturn 0}#### End_arrayhandler#### Start_itemhandlerproc finditem {itemid item} {global mel_chanid mel_chans mel_keepid mel_keepers logkeeperset result 0switch $itemid {fchan {foreach c [array names mel_chans] {set compare_chan $mel_chans($c)if {[string compare [string tolower $compare_chan] $item] == 0} {set result 1}}if {$result == 1} {return 1}return 0}fkeep {if {[string compare $item [string tolower $logkeeper]] == 0} {set result 1} else {foreach k [array names mel_keepers] {set compare_keep $mel_keepers($k)if {[string compare [string tolower $compare_keep] $item] == 0} {set result 1}}}if {$result == 1} {return 1}return 0}}}proc additem {itemid item} {global mel_chanid mel_chans mel_keepid mel_keepersswitch $itemid {achan {incr mel_chanidset mel_chans($mel_chanid) $itemcreatelog $item}akeep {incr mel_keepidset mel_keepers($mel_keepid) $item}}write_arrayreturn 0}proc delitem {itemid item} {global mel_chanid mel_chans mel_keepid mel_keepers statsdir removedchannels switchswitch $itemid {dchan {foreach c [array names mel_chans] {set foundchan $mel_chans($c)if {[string compare $foundchan $item] == 0} {endlog $itemunset mel_chans($c)if {![file exists ${statsdir}${removedchannels}]} {set create [open ${statsdir}${removedchannels} w]puts $create $itemclose $create} else {set addfile [open ${statsdir}${removedchannels} a]puts $addfile $itemclose $addfile}}}}dkeep {foreach k [array names mel_keepers] {set foundkeep $mel_keepers($k)if {[string compare $foundkeep $item] == 0} {unset mel_keepers($k)}}}}write_arrayreturn 0}#### End_itemhandler#### Start_timehandlerproc meltimer {} {global autoswitch daysamount vername switchset autoswitch 1switchlogsset newswitch [clock format [clock scan "today next $daysamount days"] -format "%d %m %Y"]foreach search [binds time] {set procname [lindex $search 4]if {[string compare $procname "meltimer"] == 0} {set binder [lindex $search 2]unbind time - "$binder" meltimer}}if {$switch == 0} { putlog "$vername Hey! Logging has been disabled! Better prevent timer binding!"return 0}bind time - "* 00 $newswitch" meltimerputlog "$vername Timer bound to the first second of [lindex $newswitch 0]/[lindex $newswitch 1]/[lindex $newswitch 2]"}proc timestarter {} {global statsdir nextswitch vername setdaysfile daysfile switch autoswitchif {$switch == 0} {foreach search [binds time] {set procname [lindex $search 4]if {[string compare $procname "meltimer"] == 0} {putlog "$vername Huh!? Found a meltimer!? disabling the timer..."set binder [lindex $search 2]unbind time - "$binder" meltimer}}return 0}set todaydmy [clock format [unixtime] -format "%d %m %Y"]set todayd [lindex $todaydmy 0]set todaym [lindex $todaydmy 1]set todayy [lindex $todaydmy 2]if {![file exists ${statsdir}${setdaysfile}]} {set create [open ${statsdir}${setdaysfile} w]puts $create "iunno... this shouldn't be here"close $createputlog "$vername Missing file ${statsdir}${setdaysfile}!!! Automatic switching disabled!"putlog "$vername You haven't used .mel setdays yet!!!! Use this at least once!!! Automatic switching disabled!"return 0}set no_start_date 0set readold [open ${statsdir}${setdaysfile} r]while {![eof $readold]} {set data [gets $readold]if {[eof $readold]} {break}if {[lindex $data 0] == "iunno..."} {set no_start_date 1break}set amount_of_days $databreak}close $readoldif {$no_start_date == 1} {putlog "$vername You haven't used .mel setdays yet!!!! Use this at least once!!! Automatic switching disabled!"return 0}set switchd [lindex $nextswitch 0]set switchm [lindex $nextswitch 1]set switchy [lindex $nextswitch 2]if {$todayy &gt; $switchy} {putlog "$vername We better switch those logfiles and create a new timer..."set newswitch [clock format [clock scan "today next $amount_of_days days"] -format "%d %m %Y"]bind time - "* 00 $newswitch" meltimerset deleteold [file delete -force ${statsdir}${daysfile}]set makenew [open ${statsdir}${daysfile} w]puts $makenew "$newswitch"close $makenewreturn 0}if {$todaym &gt; $switchm &amp;&amp; $todayy &gt;= $switchy} {putlog "$vername We better switch those logfiles and create a new timer..."set newswitch [clock format [clock scan "today next $amount_of_days days"] -format "%d %m %Y"]bind time - "* 00 $newswitch" meltimerset deleteold [file delete -force ${statsdir}${daysfile}]set makenew [open ${statsdir}${daysfile} w]puts $makenew "$newswitch"close $makenewreturn 0}if {$todayd &gt; $switchd &amp;&amp; $todaym &gt;= $switchm &amp;&amp; $todayy &gt;= $switchy} {putlog "$vername We better switch those logfiles and create a new timer..."set newswitch [clock format [clock scan "today next $amount_of_days days"] -format "%d %m %Y"]bind time - "* 00 $newswitch" meltimerset deleteold [file delete -force ${statsdir}${daysfile}]set makenew [open ${statsdir}${daysfile} w]puts $makenew "$newswitch"close $makenewreturn 0}bind time - "* 00 $nextswitch" meltimerreturn 0}#### End_timehandler#### Start_logfilehandlerproc datestamp {} {global statslogdir switch vername usenix mel_chanid mel_chansset fulldate [ctime [unixtime]]set dm [lrange $fulldate 0 1]if {[lindex $fulldate 2] == ""} {set testday 0[lindex $fulldate 3]set rest [lrange $fulldate 4 end]} else {set testday [lindex $fulldate 2]set rest [lrange $fulldate 3 end]}set starttime "$dm $testday $rest"set current [strftime %H:%M]if {![array exists mel_chans]} {putlog "$vername Use .mel +chan &lt;channel&gt;."set switch 0return 0}foreach m [array names mel_chans] {set data1 $mel_chans($m)if {$usenix == 1} {set data [string trimleft $data1 #]} else { set data $data1 }set addtimestamp [open ${statslogdir}${data}.log a]puts $addtimestamp "Session Time: $starttime"close $addtimestamp}}proc createlog {channel} {global statslogdir switch vername botnick usenixset fulldate [ctime [unixtime]]set dm [lrange $fulldate 0 1]if {[lindex $fulldate 2] == ""} {set testday 0[lindex $fulldate 3]set rest [lrange $fulldate 4 end]} else {set testday [lindex $fulldate 2]set rest [lrange $fulldate 3 end]}set starttime "$dm $testday $rest"set current [strftime %H:%M]set chan1 [string tolower $channel]if {$usenix == 1} {set chan [string trimleft $chan1 #]} else { set chan $chan1 }if {![finditem fchan $chan1]} {putlog "$vername Error! Tried to create new logfile for $chan but $chan doesn't appear to be added!"return 0}if {![file exists ${statslogdir}${chan}.log]} {set create [open ${statslogdir}${chan}.log w]puts $create "Session Start: $starttime"puts $create "\[$current\] *** Now talking in $chan1"puts $create "\[$current\] &lt;$botnick&gt; Hi"close $createputlog "$vername Created logfile for $chan1"}if {$switch == 0} {set switch 1putlog "$vername Logger turned on!"}return 0}proc endlog {channel} {global statslogdir switch vername usenixset fulldate [ctime [unixtime]]set dm [lrange $fulldate 0 1]if {[lindex $fulldate 2] == ""} {set testday 0[lindex $fulldate 3]set rest [lrange $fulldate 4 end]} else {set testday [lindex $fulldate 2]set rest [lrange $fulldate 3 end]}set endtime "$dm $testday $rest"set chan1 [string tolower $channel]if {$usenix == 1} {set chan [string trimleft $chan1 #]} else { set chan $chan1 }if {![finditem fchan $chan1]} {putlog "$vername Error! Tried to close log of channel not being logged!"return 0}if {![file exists ${statslogdir}${chan}.log]} {putlog "$vername Error! Tried to close non-existant logfile!"return 0}set add "Session Close: $endtime"set addfile [open ${statslogdir}${chan}.log a]puts $addfile $addclose $addfileputlog "$vername Closed logfile for channel $chan1"return 0}proc switchlogs {} {global statslogdir daysfile switch autoswitch switched vername usenix dslogfiles mel_chanid mel_chansif {$switch == 0} {return 0}foreach m [array names mel_chans] {set data1 $mel_chans($m)set switched 1set fulldate [ctime [unixtime]]set dm [lrange $fulldate 0 1]if {[lindex $fulldate 2] == ""} {set testday 0[lindex $fulldate 3]set rest [lrange $fulldate 4 end]} else {set testday [lindex $fulldate 2]set rest [lrange $fulldate 3 end]}set closetime "$dm $testday $rest"set add "Session Close: $closetime"if {$usenix == 1} {set data [string trimleft $data1 #]} else { set data $data1 }set addfile [open ${statslogdir}${data}.log a]puts $addfile $addclose $addfileset secs [clock seconds]set cdate [clock format [incr secs -61] -format %m.%d.%Y]if {$dslogfiles == 1} {set copynew [file rename -force ${statslogdir}${data}.log ${statslogdir}${data}.${cdate}.log]putlog "$vername Created a backup copy of ${statslogdir}${data}.log to ${statslogdir}${data}.${cdate}.log file."} else {set copynew [file rename -force ${statslogdir}${data}.log ${statslogdir}${data}.log.bak]putlog "$vername Created a backup copy of ${statslogdir}${data}.log to ${statslogdir}${data}.log.bak file."}createlog $mel_chans($m)}if {$autoswitch == 1} {putlog "$vername Procedure called automatically"}if {$autoswitch == 0} {putlog "$vername Procedure called upon users request"}}     proc killog {handle} {global removedchannels statslogdir statsdir usenixset idx [hand2idx $handle]if {![file exists ${statsdir}${removedchannels}]} {putidx $idx "All closed logfiles are already erased"return 0}putidx $idx "Removing closed logfiles..."set read [open ${statsdir}${removedchannels} r]while {![eof $read]} {set data1 [gets $read]if {[eof $read]} {break}if {$usenix == 1} {set data [string trimleft $data1 #]} else { set data $data1 }if {[file exists ${statslogdir}${data}.log]} {set remove [file delete -force ${statslogdir}${data}.log]putidx $idx "Removed ${statslogdir}${data}.log..."}if {[file exists ${statslogdir}${data}.log.bak]} {set remove [file delete -force ${statslogdir}${data}.log.bak]putidx $idx "Removed ${statslogdir}${data}.log.bak..."}}close $readset remove [file delete -force ${statsdir}${removedchannels}]putidx $idx "Removed all closed logfiles..."return 0}#### End_logfilehandler#### Start_loggingprocsproc strip {args} {regsub -all \{|\} $args "" argsregsub -all \002 $args "" argsregsub -all \037 $args "" argsregsub -all  $args "" argsregsub -all  $args "" argsregsub -all {(([0-9])?([0-9])?(\,([0-9])?([0-9])?)?)?} $args "" argsregsub -all { ([0-9A-F][0-9A-F])?} $args "" argsset arg [string trimleft $args]set lastchar [string index $arg [expr [string length $arg] -1]]if {[string compare $lastchar "\\"] == 0} {regsub -all {\\} $arg "" newargappend newarg "\\"set arg $newarg}return $arg}proc mel_event {mel_id mnick mhost mhandle mchannel arg} {global statslogdir switch usenix macmodeif {$switch == 0} {return 0}set low_chan [string tolower $mchannel]if {![finditem fchan $low_chan]} {return 0}set unick $mnickset current [strftime %H:%M]if {$usenix == 1} {set chan [string trimleft $low_chan #]} else {set chan $low_chan}if {$macmode == 1} {checklogrestart $chan}set stripped_arg [strip $arg]switch -- $mel_id { chat {set add "\[$current\] &lt;$unick&gt; $stripped_arg"} join {set add "\[$current\] *** $unick ($mhost) has joined $mchannel"} part {set add "\[$current\] *** $unick ($mhost) has left $mchannel ($stripped_arg)"} quit {set add "\[$current\] *** $unick has left $mchannel ($stripped_arg)"} topic {set add "\[$current\] *** $unick changes topic to '$stripped_arg'"} kick {set target [lindex $arg 0]set reason [strip [lrange $arg 1 end]]set add "\[$current\] *** $target was kicked by $unick ($reason)"} nick {set add "\[$current\] *** $unick is now known as $arg"} mode {set newmode [lindex $arg 0]set victim [lrange $arg 1 end]set add "\[$current\] *** $unick sets mode: $newmode $victim"} action {set add "\[$current\] * $unick $stripped_arg"}}set adding [open ${statslogdir}${chan}.log a]puts $adding "$add"close $adding}proc mel_chatter {nick host handle channel text} {mel_event chat $nick $host $handle $channel $text}proc mel_enter {nick host handle channel} {mel_event join $nick $host $handle $channel nothing}proc mel_partinga {nick host handle channel partmsg} {mel_event part $nick $host $handle $channel $partmsg}proc mel_signoff {nick host handle channel reason} {mel_event quit $nick $host $handle $channel $reason}proc mel_ctopic {nick host handle channel topic} {mel_event topic $nick $host $handle $channel $topic}proc mel_kicked {nick host handle channel target reason} {mel_event kick $nick $host $handle $channel "$target $reason"}proc mel_nickchange {nick host handle channel newnick} {mel_event nick $nick $host $handle $channel $newnick}proc mel_cmode {nick host handle channel change victim} {mel_event mode $nick $host $handle $channel "$change $victim"}proc mel_caction {nick host handle dest keyword arg} {mel_event action $nick $host $handle $dest $arg}#### End_loggingprocs#### Start_globvarstat_bif {$upgrade == 1} {if {[file exists ${statsdir}${melinitfile}]} {file rename -force ${statsdir}${melinitfile} ${statsdir}${melinitfile}.before}set create_init [open ${statsdir}${melinitfile} a]puts $create_init "\[channels\]"if {[file exists ${statsdir}channels.mel]} {set read_old [open ${statsdir}channels.mel r]while {![eof $read_old]} {set old_data [gets $read_old]if {[eof $read_old]} {break}puts $create_init $old_data}close $read_oldfile rename -force ${statsdir}channels.mel ${statsdir}channels.preset mel_chn_upd 1} else {set mel_chn_upd 0}puts $create_init "\[keepers\]"if {[file exists ${statsdir}keepers.mel]} {set read_old [open ${statsdir}keepers.mel r]while {![eof $read_old]} {set old_data [gets $read_old]if {[eof $read_old]} {break}puts $create_init $old_data}close $read_oldfile rename -force ${statsdir}keepers.mel ${statsdir}keepers.preset mel_kep_upd 1} else {set mel_kep_upd 0}puts $create_init "\[end of file\]"close $create_initswitch $mel_chn_upd { 1 {putlog "Imported channels from pre 1.5.4 version"} 0 {putlog "Channels import from pre 1.5.4 version failed: file not found"}}switch $mel_kep_upd { 1 {putlog "Imported keepers from pre 1.5.4 version"} 0 {putlog "Keepers import from pre 1.5.4 version failed: file not found"}}putlog "Ignores are no longer supported and thus not imported."putlog "$logver DO NOT FORGET TO SET 'UPGRADE' TO 0!!! DO IT NOW!!!"}mel_arrayinitreaddaysdatestampif {![file exists ${statsdir}${macfile}]} {timestarterset macmode 0} else { set macmode 1 }  putlog "\002mIRCStats Eggdrop Logger (mEL)\002 $logver by Jules loaded!"putlog "\002mIRCStats Eggdrop Logger (mEL)\002 $logver Multi-Channel Edition by SirSir loaded!"### http://mel.angelbears.org### Feel free to alter this tcl to your personal flavour... just don't forget who wrote the### original code... Also, if you find bugs, or even fix some.. then please let me know!#### End_globvarstat_b</code></pre></div><br>Thanks in advance, I appreciate any kind of help.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9361">Wuff</a> — Sat Sep 13, 2008 11:16 am</p><hr />
]]></content>
	</entry>
	</feed>
