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.
Support & discussion of released scripts, and announcements of new releases.
Thunderdome
Op
Posts: 187 Joined: Tue Mar 15, 2005 4:42 pm
Post
by Thunderdome » Fri Aug 12, 2005 12:36 am
Code: Select all
Initializing mEL 2.0....
mEL 2.0 - Running startup tests...
mEL 2.0 - Tcl version 8.4 detected... OK.
mEL 2.0 - Eggdrop version 1.6.17 detected... OK.
mEL 2.0 - scripts/mel exists and is a directory... OK.
mEL 2.0 - scripts/logs exists and is a directory... OK.
mEL 2.0 - Gabber is a valid user on this bot... OK.
Tcl error in file 'VectorSigma.conf':
expected integer but got "08" (looks like invalid octal number)
while executing
"expr [lindex $t 3] -1"
(procedure "::mel::checkstamptimer" line 27)
invoked from within
"::mel::checkstamptimer"
invoked from within
"if {[::mel::starttests]} {
putlog $::mel::starterror
die "Fatal error - Can not continue"
} else {
::mel::arrayinit
::mel::logfile datestamp all
..."
(file "scripts/mel2.tcl" line 1104)
invoked from within
"source scripts/mel2.tcl"
(file "VectorSigma.conf" line 130)
* CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
It started doing this... no file seems to be corrupted, and I've even overwritten with old files (even the logs). Yet, it keeps doing this... what is it?
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Fri Aug 12, 2005 10:14 am
[quote="Thunderdome"]
Code: Select all
expected integer but got "08" (looks like invalid octal number)[/quote]
There's the error, just track it down and convert that octal number using 'scan'.
Thunderdome
Op
Posts: 187 Joined: Tue Mar 15, 2005 4:42 pm
Post
by Thunderdome » Fri Aug 12, 2005 10:45 am
easy to say, but I don't really have any ideia of what you mean...
What shall I do exactly?
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Fri Aug 12, 2005 5:20 pm
I dont know that tcl, but judging from the error msg, this is most likely what you have to do:
Find this line (line 27 in the ::mel::checkstamptimer procedure)
and add
on the line right above it.
Thunderdome
Op
Posts: 187 Joined: Tue Mar 15, 2005 4:42 pm
Post
by Thunderdome » Fri Aug 12, 2005 9:50 pm
the script has that written all over... I don't get it...
Code: Select all
#### mIRCStats Eggdrop Logger 2.0
#### (c)1999-2004 Jules <mel@angelbears.org>
#### Multiple Channel Support by SirSir <sirsir@thuntek.net>
#### Unix/Linux Support by T_D <todd6971@msn.com> #cracks2000@EFNet
####
#### This tcl creates mIRC-style channel logfiles for use with the popular
#### mIRCStats <http://www.mircstats.com> program.
#### This script is written for Tcl 8.1 or higher and Eggdrop 1.6.0 or higher.
#### Running this script on any lower version of Tcl or Eggdrop will cause your
#### eggdrop to die.
####
#### For version history see history.txt
#### Change your settings below ####
#### Check readme.txt for explanation of these settings
namespace eval mel {
# Location of logfiles
variable statslogdir scripts/logs
# Location of configuration files
variable statsdir scripts/mel
# Static logkeeper
variable staticlogkeeper Gabber
# Add datestamp in the log itself at regular intervals (0=never 1=daily 2=weekly 3=monthly)
variable stamplogs 1
# Adds datestamp in logfile name
variable dodatestamp 0
# Use year (yyyy) instead of date in filename (in case of adding a datestamp)
variable doyearstamp 1
# Strips '#' from logfile name
variable unixnames 1
# Enable/disable host blocking
variable bhosts 0
# Day of week (1 is monday) <- for weekly rotation
variable weekly 1
# Notify static logkeeper on logfile rotation?
variable notify 1
# Ignore nicknames
variable ignorenicks {
not
logging
these
nicks
}
}
# # # # # # # # # # # # DO NOT CHANGE ANYTHING BELOW HERE # # # # # # # # # # #
bind dcc * mel ::mel::dcc
bind pubm - * ::mel::chatter
bind join - * ::mel::enter
bind sign - * ::mel::signoff
bind topc - * ::mel::ctopic
bind kick - * ::mel::kicked
bind nick - * ::mel::nickchange
bind mode - * ::mel::cmode
bind part - * ::mel::parting
bind ctcp - "ACTION" ::mel::action
namespace eval mel {
variable settings settings.mel
variable enabled 0
variable version "mEL 2.0"
variable channels
variable macmode 1
variable rotate week
variable keepers
variable deadchanfile deadchans.mel
variable nextswitch
variable weekdays
variable skipmac 0
array set weekdays {
1 monday
2 tuesday
3 wednesday
4 thursday
5 friday
6 saturday
7 sunday
}
variable actives [list statslogdir statsdir settings staticlogkeeper stamplogs dodatestamp doyearstamp skipmac macmode rotate weekdays weekly nextswitch unixnames enabled version channels keepers deadchanfile bhosts notify ignorenicks]
proc starttests {} {
variable actives
variable starterror
foreach v $actives {variable $v}
if {$::tcl_version >= "8.1"} {
putlog "$version - Tcl version $::tcl_version detected... OK."
} else {
variable starterror "Tcl version $::tcl_version detected... FAILED! I need at least Tcl 8.1 to function properly."
return 1
}
if {[string range $::numversion 0 2] >= 106} {
putlog "$version - Eggdrop version [lindex $::version 0] detected... OK."
} else {
variable starterror "Eggdrop version [lindex $::version 0] detected... FAILED! I need at least Eggdrop 1.6.0 to function properly."
return 1
}
if {![file exists $statsdir] || ![file isdirectory $statsdir]} {
variable starterror "Directory $statsdir is not found!"
return 1
} else {
putlog "$version - $statsdir exists and is a directory... OK."
}
if {![file exists $statslogdir] || ![file isdirectory $statslogdir]} {
variable starterror "Directory $statslogdir is not found!"
return 1
} else {
putlog "$version - $statslogdir exists and is a directory... OK."
}
if {[validuser $staticlogkeeper]} {
variable starterror "$staticlogkeeper is not a user on this bot (handle not found)"
return 1
}
if {[lsearch [string tolower [userlist b]] [string tolower $staticlogkeeper]] != -1} {
variable starterror "$staticlogkeeper is registered as a bot!"
return 1
}
putlog "$version - $staticlogkeeper is a valid user on this bot... OK."
return 0
}
proc dcc {handle idx args} {
set args [split [lindex $args 0]]
variable actives
foreach v $actives {variable $v}
if {![item find keep $handle]} {
putlog "#$handle# mel $args"
putidx $idx "$version - You are not allowed to perform maintenance."
putidx $idx "$version - Contact $staticlogkeeper for more information."
return 0
}
switch -- [lindex [split $args] 0] {
on {
putlog "#$handle# mel on"
if {![array exists channels]} {
putidx $idx "$version - You should add channels before turning mEL on!"
return 0
}
if {$enabled == 1} {
putidx $idx "$version - mEL already is on. Try \'.mel status\' for a status overview"
return 0
}
variable enabled 1
putidx $idx "$version - mEL is now turned on!"
return 0
}
off {
putlog "#$handle# mel off"
if {$enabled == 0} {
putidx $idx "$version - mEL already is off!"
return 0
}
variable enabled 0
putidx $idx "$version - mEL is now turned off!"
return 0
}
rotation {
putlog "#$handle# mel rotation"
if {$enabled == 0} {
putidx $idx "$version - mEL is disabled. Unable to change rotation settings."
return 0
}
switch -- [lindex $args 1] {
mac {
if {$macmode == 0} {
putlog "$version - Switching to mAC mode..."
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
putlog "$version - Event timers removed..."
switchlogs
putlog "$version - Created new logfiles for all channels..."
variable macmode 1
variable rotate mac
arraywrite
putidx $idx "$version - Now running in mAC mode"
} else {
putidx $idx "$version - Already running in mAC mode"
return 0
}
}
week {
if {$rotate == "week"} {
putidx $idx "$version - Already rotating every week"
return 0
}
if {$macmode == 0} {
variable rotate week
set t [clock format [clock scan "now next $weekdays($weekly)"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
arraywrite
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
putidx $idx "$version - Now rotating logfiles every week"
return 0
}
putlog "$version - Disabling mAC mode..."
variable macmode 0
variable rotate week
variable nextswitch {}
checktimer
switchlogs
putlog "$version - mAC mode disabled"
return 0
}
month {
if {$rotate == "month"} {
putidx $idx "$version - Already rotating every month"
return 0
}
if {$macmode == 0} {
variable rotate month
set t [clock format [clock scan "now next month"] -format "00 00 01 %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3]01T000000"]
arraywrite
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
putidx $idx "$version - Now rotating logfiles every month"
return 0
}
putlog "$version - Disabling mAC mode..."
variable macmode 0
variable rotate month
variable nextswitch {}
checktimer
switchlogs
putlog "$version - mAC mode disabled"
return 0
}
year {
if {$rotate == "year"} {
putidx $idx "$version - Already rotating every year"
return 0
}
if {$macmode == 0} {
variable rotate year
set t [clock format [clock scan "now next year"] -format "00 00 01 01 %Y"]
variable nextswitch [clock scan "[lindex $t 4]0101T000000"]
arraywrite
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
putidx $idx "$version - Now rotating logfiles every year"
return 0
}
putlog "$version - Disabling mAC mode..."
variable macmode 0
variable rotate year
variable nextswitch {}
checktimer
switchlogs
putlog "$version - mAC mode disabled"
return 0
}
default {
if {$macmode == 0} {
if {[string is integer -strict [lindex $args 1]]} {
if {[expr [lindex $args 1] < 1]} {
putidx $idx "$version - Invalid argument, expecting integer greater than zero"
return 0
}
variable rotate [lindex $args 1]
set t [clock format [clock scan "now next $rotate days"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
arraywrite
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
putidx $idx "$version - Now rotating logfiles every [lindex $args 1] days"
return 0
}
putidx $idx "$version - Invalid argument, expecting integer"
return 0
}
putlog "$version - Disabling mAC mode..."
variable macmode 0
variable rotate [lindex $args 1]
variable nextswitch {}
checktimer
switchlogs
putlog "$version - mAC mode disabled"
return 0
}
}
}
status {
putlog "#$handle# mel status"
if {[lindex $args 1] == "all"} {
showstatus [::hand2idx $handle] all
} else {
showstatus [::hand2idx $handle] norm
}
}
+chan {
set whatchan [lindex $args 1]
if {$whatchan != ""} {
putlog "#$handle# mel +chan"
if {[string index $whatchan 0] != "#"} {set whatchan "#$whatchan"}
if {[item find chan $whatchan]} {
putidx $idx "$version - $whatchan is already being logged"
return 0
}
set cflag 0
foreach c [::channels] {
if {[string compare -nocase $whatchan $c] == 0} {set cflag 1}
}
if {$cflag == 0} {
putidx $idx "$version - Can't add $whatchan - I am not on that channel"
return 0
}
variable enabled 1
if {![info exists nextswitch]} {
variable nextswitch 0
}
variable skipmac 1
item add chan $whatchan
variable skipmac 0
putidx $idx "$version - Now logging channel $whatchan"
return 0
}
putidx $idx "$version - You forgot to include a channel!"
return 0
}
-chan {
set whatchan [lindex [split $args] 1]
if {$whatchan != ""} {
putlog "#$handle# mel -chan"
if {[string index $whatchan 0] != "#"} {set whatchan "#$whatchan"}
if {![array exists channels]} {
putidx $idx "$version - Can't remove any channel because no channels have been added yet!"
return 0
}
if {![item find chan $whatchan]} {
putidx $idx "$version - Can't remove channel $whatchan because channel hasn't been added yet!"
return 0
}
item del chan $whatchan
putidx $idx "$version - No longer logging channel $whatchan"
putidx $idx "$version - Use \'.mel erase\' to remove the logfiles for channel $whatchan"
return 0
}
putidx $idx "$version - You forgot to include a channel!"
return 0
}
+keep {
set who [lindex [split $args] 1]
if {$who != ""} {
putlog "#$handle# mel +keep"
if {[string compare -nocase $handle $staticlogkeeper] != 0} {
putidx $idx "$version - You can't add or remove logkeepers"
return 0
}
if {![::validuser $who]} {
putidx $idx "$version - $who is not a valid user on this bot"
return 0
}
if {[item find keep $who]} {
putidx $idx "$version - $who already is a logkeeper"
return 0
}
item add keep $who
putidx $idx "$version - $who has been added as a logkeeper"
return 0
}
putidx $idx "$version - You forgot to specify a username!"
return 0
}
-keep {
set who [lindex [split $args] 1]
if {$who != ""} {
putlog "#$handle# mel -keep"
if {[string compare -nocase $handle $staticlogkeeper] != 0} {
putidx $idx "$version - You can't add or remove logkeepers"
return 0
}
if {[string compare -nocase $who $staticlogkeeper] == 0} {
putidx $idx "$version - You can't remove the static logkeeper from the partyline"
return 0
}
if {![item find keep $who]} {
putidx $idx "$version - $who is not registeren as a logkeeper"
return 0
}
item del keep $who
putidx $idx "$version - $who has been removed as a logkeeper"
return 0
}
putidx $idx "$version - You forgot to specify a username!"
return 0
}
erase {
putlog "#$handle# mel erase"
logfile kill [::hand2idx $handle]
return 0
}
default {
putidx $idx "\002Usage:\002 .mel <on/off/rotation/status/+chan/-chan/+keep/-keep/erase>"
putidx $idx "For more details refer to the helpfile or type \'.help mel\'"
return 0
}
}
}
proc justify {args} {
if {![info exists ::spacer]} {set spc " "} else {set spc [string index $::spacer 0]}
set msg [lindex $args 1]
set width [lindex $args end]
switch -- [lindex $args 0] {
l {
if {$width <= [string length $msg]} {return $msg}
return [string replace [string repeat $spc $width] 0 [expr [string length $msg] -1] $msg]
}
r {
if {$width <= [string length $msg]} {return $msg}
return [string replace [string repeat $spc $width] [expr $width - [string length $msg]] end $msg]
}
c {
set startat [expr [expr $width/2] - [expr [string length $msg]/2]]
set lastchar [expr $startat + [expr [string length $msg] -1]]
if {$startat<=0} {return $msg}
return [string replace [string repeat $spc $width] $startat $lastchar $msg]
}
lr {
set msg1 $msg
set msg2 [lindex $args 2]
if {$width <= [expr [string length $msg1] + [string length $msg2]]} {return "$msg1$msg2"}
return [string replace [string replace [string repeat $spc $width] 0 [expr [string length $msg1] -1] $msg1] [expr $width - [string length $msg2]] end $msg2]
}
}
}
proc showstatus {idx mode} {
variable actives
foreach v $actives {variable $v}
set fline "+[string repeat - 58]+"
putidx $idx $fline
putidx $idx "|[justify c "$version Status Overview" 58]|"
putidx $idx $fline
putidx $idx "|[justify l " Today is \002[clock format [clock scan now] -format %c]\002" 60]|"
if {$mode == "all"} {
if {$enabled == 1} {set st "\002enabled\002"} else {set st "\002disabled\002"}
putidx $idx "|[justify l " mEL is currently $st" 60]|"
if {$bhosts == 1} {set st "\002enabled\002"} else {set st "\002disabled\002"}
putidx $idx "|[justify l " Host blocking is $st" 60]|"
if {$macmode == 1} {set st "\002enabled\002"} else {set st "\002disabled\002"}
putidx $idx "|[justify l " mAC mode is currently $st" 60]|"
}
putidx $idx $fline
if {[array size channels] > 0} {
putidx $idx "|[justify l " Currently logging the following channels:" 58]|"
foreach c [lsort [array names channels]] {
putidx $idx "|[justify l " \002$channels($c)\002" 60]|"
}
putidx $idx $fline
} else {
putidx $idx "|[justify l " Currently no channels are being logged" 58]|"
putidx $idx $fline
}
if {$mode == "all"} {
putidx $idx "|[justify l " Current logkeepers:" 58]|"
putidx $idx "|[justify l " \002$staticlogkeeper\002 (static)" 60]|"
if {[array size keepers] > 0} {
foreach k [lsort [array names keepers]] {
putidx $idx "|[justify l " \002$keepers($k)\002" 60]|"
}
}
putidx $idx $fline
}
if {$macmode == 0} {
if {[string is integer $rotate]} {
putidx $idx "|[justify l " Logfiles will rotate every \002$rotate day(s)\002" 60]|"
} else {
putidx $idx "|[justify l " Logfiles will rotate every \002$rotate\002" 60]|"
}
putidx $idx $fline
putidx $idx "|[justify l " Next logfile rotation will be at:" 58]|"
putidx $idx "|[justify l " \002[clock format $nextswitch -format %c]\002" 60]|"
putidx $idx $fline
}
if {$mode == "all"} {
if {[file pathtype $statsdir] == "relative" } {
putidx $idx "|[justify l " Storing settings in:" 58]|"
putidx $idx "|[justify l " \002[file nativename [pwd]/$statsdir]\002" 60]|"
} else {
putidx $idx "|[justify l " Storing settings in:" 58]|"
putidx $idx "|[justify l " \002[file nativename $statsdir]\002" 60]|"
}
if {[file pathtype $statslogdir] == "relative" } {
putidx $idx "|[justify l " Storing logfiles in:" 58]|"
putidx $idx "|[justify l " \002[file nativename [pwd]/$statslogdir]\002" 60]|"
} else {
putidx $idx "|[justify l " Storing logfiles in:" 58]|"
putidx $idx "|[justify l " \002[file nativename $statslogdir]\002" 60]|"
}
putidx $idx $fline
}
}
proc logfile {action chan} {
variable actives
foreach v $actives {variable $v}
switch -- $action {
create {
set starttime [clock format [clock scan now] -format "%a %b %d %T %Y"]
set time_current [clock format [clock scan now] -format "%H:%M"]
if {[expr $unixnames < 1]} {
set curFilename [string tolower ${chan}.log]
} else {
set curFilename [string tolower [string range $chan 1 end].log]
}
if {![item find chan $chan]} {
putlog "$version - Unable to create logfile for channel not in array! Channel: $chan"
return 0
}
if {![file exists [file join $statslogdir $curFilename]]} {
variable skipmac 1
writelog sesdata 0 1 2 $chan "Session Start: $starttime"
writelog sesdata 0 1 2 $chan "\[$time_current\] *** Now talking in $chan"
variable skipmac 0
putlog "$version - Created logfile for $chan"
} else {
putlog "$version - Can't create logfile for channel $chan - Appending to existing logfile"
return 0
}
return 0
}
close {
set stoptime [clock format [clock scan now] -format "%a %b %d %T %Y"]
if {[expr $unixnames < 1]} {
set curFilename [string tolower ${chan}.log]
} else {
set curFilename [string tolower [string range $chan 1 end].log]
}
if {![item find chan $chan]} {
putlog "$version - Cannot close logfile for $chan. Channel not in array!"
return 0
}
putlog "$version - Channel $chan has logfile [file join $statslogdir $curFilename]"
if {![file exists [file join $statslogdir $curFilename]]} {
putlog "$version - Cannot close logfile for $chan. File does not exist!"
return 0
}
writelog sesdata 0 1 2 $chan "Session Close: $stoptime"
putlog "$version - Closed logfile for $chan"
return 0
}
kill {
set handle $chan
set dffile [file join $statsdir $deadchanfile]
if {![file exists $dffile]} {
putidx $handle "All redundant logfiles already removed!"
return 0
}
putidx $handle "Deleting redundant logfiles..."
set read_dead [open $dffile r]
while {![eof $read_dead]} {
set data [gets $read_dead]
if {[eof $read_dead]} {break}
if {[expr $unixnames < 1]} {
set curFilename [string tolower $data].log"
} else {
set curFilename [string tolower [string range $data 1 end]]
}
foreach dead_chan [glob -nocomplain [file join $statslogdir $curFilename]*] {
file delete -force $dead_chan
if {[file pathtype $dead_chan] == "relative"} {putidx $handle "Deleted [pwd]/$dead_chan..."} else {putidx $handle "Deleted $dead_chan..."}
}
}
close $read_dead
file delete -force $dffile
putidx $handle "\nFinished deleting redundant logfiles..."
return 0
}
datestamp {
set starttime [clock format [clock scan now] -format "%a %b %d %T %Y"]
if {![array exists channels] || [array size channels] < 1} {
putlog "$version - No channels defined. Use +chan first. Unable to add datestamp in logfile."
variable enabled 0
return 0
}
foreach c [lsort [array names channels]] {
writelog sesdata 0 1 2 $channels($c) "Session Time: $starttime"
}
return 0
}
}
}
proc switchlogs {} {
variable actives
foreach v $actives {variable $v}
if {$enabled == 0} {return 0}
foreach c [lsort [array names channels]] {
set curChan $channels($c)
logfile close $curChan
if {[expr $unixnames < 1]} {
set curFilename [string tolower $curChan]
} else {
set curFilename [string tolower [string range $curChan 1 end]]
}
if {$dodatestamp == 1} {
if {$doyearstamp == 0} {
set date [clock format [clock scan "now yesterday"] -format %m.%d.%Y]
} else {
set date [clock format [clock scan "now yesterday"] -format %Y]
}
file rename -force [file join $statslogdir $curFilename].log [file join $statslogdir $curFilename].${date}.log
} else {
file rename -force [file join $statslogdir $curFilename].log [file join $statslogdir $curFilename].bak
}
logfile create $curChan
}
if {$notify == 1} {
sendnote mEL $staticlogkeeper "$version - Logfiles have rotated at [clock format [clock scan now] -format %c]"
}
}
proc checktimer {} {
variable actives
foreach v $actives {variable $v}
if {$nextswitch == ""} {
putlog "$version - No rotation date found - Binding new timer (logfile switcher)"
switch -- $rotate {
week {
set t [clock format [clock scan "now next $weekdays($weekly)"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
month {
set t [clock format [clock scan "now next month"] -format "00 00 01 %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3]01T000000"]
}
year {
set t [clock format [clock scan "now next year"] -format "00 00 01 01 %Y"]
variable nextswitch [clock scan "[lindex $t 4]0101T000000"]
}
default {
set t [clock format [clock scan "now next $rotate days"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
}
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
arraywrite
return 0
}
if {[expr [clock scan now] > $nextswitch]} {
putlog "$version - Missed a switch at [clock format $nextswitch -format %c]... switching now"
switchlogs
switch -- $rotate {
week {
set t [clock format [clock scan "now next $weekdays($weekly)"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
month {
set t [clock format [clock scan "now next month"] -format "00 00 01 %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3]01T000000"]
}
year {
set t [clock format [clock scan "now next year"] -format "00 00 01 01 %Y"]
variable nextswitch [clock scan "[lindex $t 4]0101T000000"]
}
default {
set t [clock format [clock scan "now next $rotate days"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
}
arraywrite
}
set t [clock format $nextswitch -format "00 00 %d %m %Y"]
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
return 0
}
proc checkstamptimer {} {
variable actives
foreach v $actives {variable $v}
switch -- $stamplogs {
0 {
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::stamptimer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::stamptimer
}
}
return 0
}
1 {
set t [clock format [clock scan "now next day"] -format "00 00 %d %m %Y"]
variable stampat [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
2 {
set t [clock format [clock scan "now next monday"] -format "00 00 %d %m %Y"]
variable stampat [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
3 {
set t [clock format [clock scan "now next month"] -format "00 00 01 %m %Y"]
variable stampat [clock scan "[lindex $t 4][lindex $t 3]01T000000"]
}
}
set t [clock format $stampat -format "00 00 %d %m %Y"]
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::stamptimer
return 0
}
proc stamptimer {min hour day month year} {
variable actives
foreach v $actives {variable $v}
logfile datestamp all
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::stamptimer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::stamptimer
}
}
if {$enabled == 0} {
putlog "$version - mEL is disabled - Not binding timed event (log datestamping)"
return 0
}
checkstamptimer
return 0
}
proc timer {min hour day month year} {
variable actives
foreach v $actives {variable $v}
if {$enabled == 0} {return 0}
switchlogs
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
if {$enabled == 0} {
putlog "$version - mEL is disabled - Not binding timed event (logfile switching)"
return 0
}
switch -- $rotate {
week {
set t [clock format [clock scan "now next $weekdays($weekly)"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
month {
set t [clock format [clock scan "now next month"] -format "00 00 01 %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3]01T000000"]
}
year {
set t [clock format [clock scan "now next year"] -format "00 00 01 01 %Y"]
variable nextswitch [clock scan "[lindex $t 4]0101T000000"]
}
default {
set t [clock format [clock scan "now next $rotate days"] -format "00 00 %d %m %Y"]
variable nextswitch [clock scan "[lindex $t 4][lindex $t 3][lindex $t 2]T000000"]
}
}
arraywrite
set t [clock format $nextswitch -format "00 00 %d %m %Y"]
if {[string length [expr [lindex $t 3] -1]] == 1} {
set tt [lreplace $t 3 3 0[expr [lindex $t 3] -1]]
} else {
set tt [lreplace $t 3 3 [expr [lindex $t 3] -1]]
}
bind time - $tt ::mel::timer
putlog "$version - Next switch will occur at [clock format $nextswitch -format %c]"
return 0
}
proc arrayinit {} {
variable actives
foreach v $actives {variable $v}
if {![file exists [file join $statsdir $settings]]} {
variable enabled 0
return 1
}
set readsettings [open [file join $statsdir $settings] r]
set datatype 0
while {![eof $readsettings]} {
set data [gets $readsettings]
if {[eof $readsettings]} {break}
if {[string index [lindex $data 0] 0] == "\["} {
regsub -all {[\[\]]} $data {} type
switch -- $type {
channels { set datatype 1 }
keepers { set datatype 2 }
rotation { set datatype 3 }
switch { set datatype 4 }
EOF { break }
}
continue
}
switch -- $datatype {
0 { continue }
1 { lappend allchans $data ; continue }
2 { lappend allkeeps $data ; continue }
3 { set tmac $data ; continue }
4 { set swdate $data ; continue }
}
}
close $readsettings
array unset channels
if {[info exists allchans]} {
set cnt 0
foreach c $allchans {
set channels($cnt) $c
incr cnt
}
variable enabled 1
} else {
variable enabled 0
return 0
}
array unset keepers
if {[info exists allkeeps]} {
set cnt 0
foreach k $allkeeps {
set keepers($cnt) $k
incr cnt
}
}
switch -- $tmac {
mac {
variable macmode 1
}
week {
variable macmode 0
variable rotate week
}
month {
variable macmode 0
variable rotate month
}
year {
variable macmode 0
variable rotate year
}
default {
variable macmode 0
variable rotate $tmac
}
}
variable nextswitch $swdate
return 0
}
proc arraywrite {} {
variable actives
foreach v $actives {variable $v}
if {[file exists [file join $statsdir $settings]]} {
file rename -force [file join $statsdir $settings] [file join $statsdir $settings].old
}
set writesettings [open [file join $statsdir $settings] w]
puts $writesettings "\[channels\]"
foreach c [lsort [array names channels]] {
puts $writesettings $channels($c)
}
puts $writesettings "\[keepers\]"
foreach k [lsort [array names keepers]] {
puts $writesettings $keepers($k)
}
puts $writesettings "\[rotation\]"
puts $writesettings $rotate
puts $writesettings "\[switch\]"
puts $writesettings $nextswitch
puts $writesettings "\[EOF\]"
close $writesettings
}
proc item {action type item} {
variable actives
foreach v $actives {variable $v}
switch -- $action {
find {
switch -- $type {
chan {
if {[array exists channels]} {
foreach c [array names channels] {
if {[string compare -nocase $channels($c) $item] == 0} {
return 1
}
}
}
return 0
}
keep {
if {[string compare -nocase $item $staticlogkeeper] == 0} {
return 1
}
if {[array exists keepers]} {
foreach k [array names keepers] {
if {[string compare -nocase $keepers($k) $item] == 0} {
return 1
}
}
}
return 0
}
}
}
add {
switch -- $type {
chan {
if {![array exists channels]} {
set channels(0) $item
} else {
set channels([expr [array size channels] + 1]) $item
}
logfile create $item
if {[file exists [file join $statsdir $deadchanfile]]} {
set read [open [file join $statsdir $deadchanfile] r]
while {![eof $read]} {
set data [gets $read]
if {[eof $read]} {break}
if {[string compare -nocase $item $data] != 0} {
set write [open [file join $statsdir $deadchanfile].tmp a]
puts $write $data
close $write
}
}
close $read
if {[file exists [file join $statsdir $deadchanfile].tmp]} {
file rename -force [file join $statsdir $deadchanfile].tmp [file join $statsdir $deadchanfile]
} else {
file delete -force [file join $statsdir $deadchanfile]
}
}
arraywrite
}
keep {
if {![array exists keepers]} {
set keepers(0) $item
} else {
set keepers([expr [array size keepers] + 1]) $item
}
arraywrite
}
}
}
del {
switch -- $type {
chan {
foreach c [array names channels] {
if {[string compare -nocase $channels($c) $item] == 0} {
logfile close $item
unset channels($c)
set add_dead [open [file join $statsdir $deadchanfile] a]
puts $add_dead $item
close $add_dead
if {[array names channels] == ""} {
variable enabled 0
foreach search [binds time] {
if {[string compare [lindex $search 4] "::mel::timer"] == 0} {
unbind time - "[lindex $search 2]" ::mel::timer
}
}
putlog "$version - No channels are being logged. mEL turned off, existing time bindings removed."
}
arraywrite
}
}
}
keep {
foreach k [array names keepers] {
if {[string compare -nocase $keepers($k) $item] == 0} {
unset keepers($k)
arraywrite
}
}
}
}
}
}
}
proc strip {args} {
foreach char [split $args {}] {
if {[string is graph $char] || $char == " "} {
append printable $char
}
}
return $printable
}
proc writelog {args} {
variable actives
foreach v $actives {variable $v}
if {$enabled == 0} {return 0}
if {$bhosts == 1 && [isignore [lindex $args 2]]} {return 0}
set curTime [clock format [clock scan now] -format "%H:%M"]
set curChannel [string tolower [lindex $args 4]]
if {![item find chan $curChannel]} { return 0 }
if {[expr $unixnames < 1]} {
set curFilename ${curChannel}.log
} else {
set curFilename [string range $curChannel 1 end].log
}
if {$skipmac == 0} {
if {$macmode == 1 && ![file exists [file join $statslogdir $curFilename]]} {
logfile create $curChannel
}
}
switch -- [lindex $args 0] {
chat {
if {[lsearch -exact [string tolower $ignorenicks] [string tolower [lindex $args 1]]] == -1} {
set addline "\[$curTime\] <[lindex $args 1]> [join [strip [lindex $args 5]]]"
} else {
return 0
}
}
join {set addline "\[$curTime\] *** [lindex $args 1] ([lindex $args 2]) has joined $curChannel"}
quit {set addline "\[$curTime\] *** [lindex $args 1] has quit IRC ([join [strip [lindex $args 5]]])"}
topic {
if {[lindex $args 1] == "*"} {return}
set addline "\[$curTime\] *** [lindex $args 1] changes topic to '[join [strip [lindex $args 5]]]'"
}
kick {set addline "\[$curTime\] *** [lindex $args 5] was kicked by [lindex $args 1] ([lindex $args 6])"}
nick {set addline "\[$curTime\] *** [lindex $args 1] is now known as [lindex $args 5]"}
mode {set addline "\[$curTime\] *** [lindex $args 1] sets mode: [lindex $args 5] [lindex $args 6]"}
part {set addline "\[$curTime\] *** [lindex $args 1] ([lindex $args 2]) has left [lindex $args 4] ([lindex $args 5])"}
action {
if {[lsearch -exact [string tolower $ignorenicks] [string tolower [lindex $args 1]]] == -1} {
set addline "\[$curTime\] * [lindex $args 1] [join [strip [lindex $args 5]]]"
} else {
return 0
}
}
sesdata {set addline [lindex $args 5]}
}
set writeout [open [file join $statslogdir $curFilename] a]
puts $writeout $addline
close $writeout
}
proc chatter {nick host handle channel text} {writelog chat $nick $host $handle $channel $text}
proc enter {nick host handle channel} {writelog join $nick $host $handle $channel}
proc signoff {nick host handle channel partmsg} {writelog quit $nick $host $handle $channel $partmsg}
proc ctopic {nick host handle channel topic} {writelog topic $nick $host $handle $channel $topic}
proc kicked {nick host handle channel target reason} {writelog kick $nick $host $handle $channel $target $reason}
proc nickchange {nick host handle channel newnick} {writelog nick $nick $host $handle $channel $newnick}
proc cmode {nick host handle channel change victim} {writelog mode $nick $host $handle $channel $change $victim}
proc parting {nick host handle channel partmsg} {writelog part $nick $host $handle $channel $partmsg}
proc action {nick host handle destination keyword arg} {writelog action $nick $host $handle $destination $arg}
}
putlog "Initializing $::mel::version...."
putlog "$::mel::version - Running startup tests..."
if {[::mel::starttests]} {
putlog $::mel::starterror
die "Fatal error - Can not continue"
} else {
::mel::arrayinit
::mel::logfile datestamp all
if {$::mel::macmode == 0 && $::mel::enabled == 1} {
::mel::checktimer
}
::mel::checkstamptimer
loadhelp mel.help
putlog "$::mel::version successfully initialized..."
}
### http://mel.sourceforge.net
### 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!
Thunderdome
Op
Posts: 187 Joined: Tue Mar 15, 2005 4:42 pm
Post
by Thunderdome » Sat Sep 03, 2005 9:15 pm
I still can't make the script work...
anyone?
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Sun Sep 04, 2005 8:56 pm
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
Thunderdome
Op
Posts: 187 Joined: Tue Mar 15, 2005 4:42 pm
Post
by Thunderdome » Wed Sep 07, 2005 12:25 pm
I have read that already and tried a fix there... the fix works out, altough is not that easy to understand... I suggest people using mel fix the problem, even before ti appears...
Think of it as a new "self update"
pobunjeni
Voice
Posts: 5 Joined: Sun Aug 12, 2007 6:43 am
Contact:
Post
by pobunjeni » Sun Aug 12, 2007 6:45 am
can someone paste the fixed mel.tcl because i can't get him to work.
Alchera
Revered One
Posts: 3344 Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:
Post
by Alchera » Sun Aug 12, 2007 10:57 am
pobunjeni wrote: can someone paste the fixed mel.tcl because i can't get him to work.
Search the Tcl Archive for something that does work.
Add [SOLVED] to the thread title if your issue has been.
Search |
FAQ |
RTM
mabus
Voice
Posts: 27 Joined: Fri Jun 17, 2005 6:19 pm
Post
by mabus » Thu Sep 13, 2007 9:08 am
The fix only seems to work if you turn off the variables involved in date stamping the logs {on top}. It's not a perfect solution quite yet.
The rotation problem seems to still be there. Trying to rotate daily gives nothing but error messages. Weekly gives an error message the first time you set it, and accepts it the second time. Monthly accepts it outright.
No clue as yet if it will actually rotate with this "fix", I've set it to week {the shorter period it seems to allow without an error message} and we'll see how it goes.
Today is Thursday September 13th so we should know by Friday morning next week September 21st.
DragnLord
Owner
Posts: 711 Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA
Post
by DragnLord » Thu Sep 13, 2007 10:39 pm
what is all this "stuff" about mel.tcl, that wasn't the problem...
The following are the relevant error lines telling where the problem is:
"Tcl error in file 'VectorSigma.conf': "
"(file "VectorSigma.conf" line 130)"
mabus
Voice
Posts: 27 Joined: Fri Jun 17, 2005 6:19 pm
Post
by mabus » Fri Sep 14, 2007 9:56 am
Thanks Rosc2112, i'll try that out
Dragonlord, all that means is that the line in the bot which loads the script caused an error {there's an error in the Mel script}. That's not the problem. The problem is with the script itself.
mabus
Voice
Posts: 27 Joined: Fri Jun 17, 2005 6:19 pm
Post
by mabus » Wed Sep 26, 2007 10:35 am
mabus wrote: The fix only seems to work if you turn off the variables involved in date stamping the logs {on top}. It's not a perfect solution quite yet.
The rotation problem seems to still be there. Trying to rotate daily gives nothing but error messages. Weekly gives an error message the first time you set it, and accepts it the second time. Monthly accepts it outright.
No clue as yet if it will actually rotate with this "fix", I've set it to week {the shorter period it seems to allow without an error message} and we'll see how it goes.
Today is Thursday September 13th so we should know by Friday morning next week September 21st.
Still does not work.