diff options
| author | 2007-07-04 02:00:24 +0000 | |
|---|---|---|
| committer | 2007-07-04 02:00:24 +0000 | |
| commit | 2e39d5b2b95c2e705fd962c9752070f816c1dfec (patch) | |
| tree | 64d6fde2a4cd488d7add12ca4897daee216777ae /modules | |
| parent | 6fe4d3ecbdc3196c7c62b9b7e00d5063bd0dbee9 (diff) | |
critical bug fix + code optimizations
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/classes.pl | 14 | ||||
| -rw-r--r-- | modules/command.pl | 1 | ||||
| -rw-r--r-- | modules/event.pl | 2 | ||||
| -rw-r--r-- | modules/inspect.pl | 3 | ||||
| -rw-r--r-- | modules/log.pl | 27 |
5 files changed, 31 insertions, 16 deletions
diff --git a/modules/classes.pl b/modules/classes.pl index 93c5e12..b540a9a 100644 --- a/modules/classes.pl +++ b/modules/classes.pl @@ -11,6 +11,7 @@ sub new my $module = shift; my $self = {}; my $tbl = { + "strbl" => \&strbl, "dnsbl" => \&dnsbl, "floodqueue" => \&floodqueue, "nickspam" => \&nickspam, @@ -147,6 +148,19 @@ sub re { return 0; } +sub strbl { + my ($chk, $id, $event, $chan) = @_; + my $match = lc $event->{args}->[0]; + foreach my $line (@::string_blacklist) { + my $xline = lc $line; + my $idx = index $match, $xline; + if ( $idx != -1 ) { + return 1; + } + } + return 0; +} + sub nick { my ($chk, $id, $event, $chan) = @_; if ( lc $event->{nick} eq lc $chk->{content} ) { diff --git a/modules/command.pl b/modules/command.pl index b0523c4..04f1d90 100644 --- a/modules/command.pl +++ b/modules/command.pl @@ -1,6 +1,7 @@ package ASM::Commander; use warnings; use strict; +use IO::All; sub new { diff --git a/modules/event.pl b/modules/event.pl index ede0efd..971a542 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -4,6 +4,7 @@ use strict; use Data::Dumper; use Text::LevenshteinXS qw(distance); +use IO::All; #require 'modules/inspect.pl'; sub cs { @@ -77,6 +78,7 @@ sub on_join { my $chan = lc $event->{to}->[0]; if ( lc $conn->{_nick} eq lc $nick) { $::sc{$chan} = {}; + mkdir($::settings->{log}->{dir} . $chan); $conn->sl("who $chan"); $conn->privmsg('ChanServ', "op $chan" ) if (defined cs($chan)->{op}) && (cs($chan)->{op} eq 'yes'); } diff --git a/modules/inspect.pl b/modules/inspect.pl index a5fd732..bed8a46 100644 --- a/modules/inspect.pl +++ b/modules/inspect.pl @@ -3,6 +3,7 @@ use warnings; use strict; use Data::Dumper; +use List::Util qw(first); %::ignored = (); sub new @@ -23,7 +24,7 @@ sub inspect { my @override = []; our $unmode=''; my $nick = lc $event->{nick}; - return if (defined($::eline{$nick}) || defined($::eline{lc $event->{user}}) || defined(lc $event->{host})); + return if (defined($::eline{$nick}) || defined($::eline{lc $event->{user}}) || defined($::eline{lc $event->{host}})); $iaddr = gethostbyname($event->{host}); $rev = join('.', reverse(unpack('C4', $iaddr))).'.' if (defined $iaddr); %monx = defined($::channels->{channel}->{master}->{event}) ? %{$::channels->{channel}->{master}->{event}} : (); diff --git a/modules/log.pl b/modules/log.pl index 759a3ea..e8a178a 100644 --- a/modules/log.pl +++ b/modules/log.pl @@ -1,12 +1,10 @@ +package ASM::Log; + use warnings; use strict; -package ASM::Log; - -#use String::Interpolate qw(interpolate); -use IO::All; +#use IO::All; use POSIX qw(strftime); -use Data::Dumper; sub new { @@ -14,7 +12,6 @@ sub new my $config = shift; my $self = {}; $self->{CONFIG} = $config; - $self->{MD} = {}; bless($self); return $self; } @@ -30,11 +27,8 @@ sub logg foreach my $chan ( @chans ) { $chan = lc $chan; - unless (defined($self->{MD}->{$chan}) && ($self->{MD}->{$chan} == 1)) { - io($cfg->{dir} . $chan)->mkpath; - $self->{MD}->{$chan} = 1; - } - $_=''; + my $path = ">>$cfg->{dir}${chan}/${chan}" . strftime($cfg->{filefmt}, @time); + $_ = ''; $_ = "<$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'; @@ -45,10 +39,13 @@ sub logg $_ = "-$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 ''); - $_ = strftime($cfg->{timefmt}, @time) . $_ . "\n" unless $_ eq ''; - $_ >> io($cfg->{dir} . $chan . '/' . $chan . strftime($cfg->{filefmt}, @time)) unless ($_ eq ''); + $_ = strftime($cfg->{timefmt}, @time) . $_ . "\n"; + my $line = $_; + open(FH, $path) or die "Can't open $path: $!"; + print FH $line; + close(FH); +# $_ >> io($path); } } -return 1; +1; |
