summaryrefslogtreecommitdiffstats
path: root/modules/log.pl
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-07-03 23:26:43 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2007-07-03 23:26:43 +0000
commit6fe4d3ecbdc3196c7c62b9b7e00d5063bd0dbee9 (patch)
tree2804867a892bf9d6bb3c231b02938896accb5b91 /modules/log.pl
parentf52c9bd6e6e018ff0c45f1dea4ded2aeb4ae1427 (diff)
code optimizations, rehash bugfix, lots of cleanup, new hilights, removed some old rules, added and improved some new rules
Diffstat (limited to 'modules/log.pl')
-rw-r--r--modules/log.pl32
1 files changed, 18 insertions, 14 deletions
diff --git a/modules/log.pl b/modules/log.pl
index 19b44b3..759a3ea 100644
--- a/modules/log.pl
+++ b/modules/log.pl
@@ -3,7 +3,7 @@ use strict;
package ASM::Log;
-use String::Interpolate qw(interpolate);
+#use String::Interpolate qw(interpolate);
use IO::All;
use POSIX qw(strftime);
use Data::Dumper;
@@ -14,6 +14,7 @@ sub new
my $config = shift;
my $self = {};
$self->{CONFIG} = $config;
+ $self->{MD} = {};
bless($self);
return $self;
}
@@ -29,21 +30,24 @@ sub logg
foreach my $chan ( @chans )
{
$chan = lc $chan;
- io(interpolate($cfg->{dir}))->mkpath;
+ unless (defined($self->{MD}->{$chan}) && ($self->{MD}->{$chan} == 1)) {
+ io($cfg->{dir} . $chan)->mkpath;
+ $self->{MD}->{$chan} = 1;
+ }
$_='';
- $_ = "<$event->{nick}> $event->{args}->[0]" if $event->{type} eq 'public';
- $_ = "*** $event->{nick} has joined $chan" if $event->{type} eq 'join';
- $_ = "*** $event->{nick} has left $chan" if $event->{type} eq 'part';
- $_ = "* $event->{nick} $event->{args}->[0]" if $event->{type} eq 'caction';
- $_ = "*** $event->{nick} is now known as $event->{args}->[0]" if $event->{type} eq 'nick';
- $_ = "*** $event->{nick} has quit IRC" if $event->{type} eq 'quit';
- $_ = "*** $event->{to}->[0] was kicked by $event->{nick}" if $event->{type} eq 'kick';
- $_ = "-$event->{nick}- $event->{args}->[0]" if $event->{type} eq 'notice';
- $_ = "*** $event->{nick} sets mode: ".join(" ",@{$event->{args}}) if $event->{type} eq 'mode';
- $_ = "*** $event->{nick} changes topic to \"$event->{args}->[0]\"" if $event->{type} eq 'topic';
+ $_ = "<$event->{nick}> $event->{args}->[0]" if $event->{type} eq 'public';
+ $_ = "*** $event->{nick} has joined $chan" if $event->{type} eq 'join';
+ $_ = "*** $event->{nick} has left $chan" if $event->{type} eq 'part';
+ $_ = "* $event->{nick} $event->{args}->[0]" if $event->{type} eq 'caction';
+ $_ = "*** $event->{nick} is now known as $event->{args}->[0]" if $event->{type} eq 'nick';
+ $_ = "*** $event->{nick} has quit IRC" if $event->{type} eq 'quit';
+ $_ = "*** $event->{to}->[0] was kicked by $event->{nick}" if $event->{type} eq 'kick';
+ $_ = "-$event->{nick}- $event->{args}->[0]" if $event->{type} eq 'notice';
+ $_ = "*** $event->{nick} sets mode: " . join(" ",@{$event->{args}}) if $event->{type} eq 'mode';
+ $_ = "*** $event->{nick} changes topic to \"$event->{args}->[0]\"" if $event->{type} eq 'topic';
print Dumper($event) if ($_ eq '');
- $_ = interpolate(strftime($cfg->{timefmt}, @time)) . $_ . "\n" unless $_ eq '';
- $_ >> io(interpolate($cfg->{dir}).'/'.interpolate(strftime($cfg->{filefmt}, @time))) unless ($_ eq '');
+ $_ = strftime($cfg->{timefmt}, @time) . $_ . "\n" unless $_ eq '';
+ $_ >> io($cfg->{dir} . $chan . '/' . $chan . strftime($cfg->{filefmt}, @time)) unless ($_ eq '');
}
}