diff options
| author | 2015-12-18 11:54:52 +0400 | |
|---|---|---|
| committer | 2015-12-18 11:54:52 +0400 | |
| commit | ed53ab7178841862af88f05fafe56a7b8504d527 (patch) | |
| tree | 0500847db7fe136522cee741eb824ffc6045d9d5 /lib/ASM | |
| parent | ab8980833473b8d5ab10d025d2e6f0301b5d4d9c (diff) | |
Ignore channels that are +s and not monitored when making actionlogs
Diffstat (limited to 'lib/ASM')
| -rw-r--r-- | lib/ASM/Event.pm | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/ASM/Event.pm b/lib/ASM/Event.pm index f9ae609..a5f1cc9 100644 --- a/lib/ASM/Event.pm +++ b/lib/ASM/Event.pm @@ -290,7 +290,8 @@ sub on_part my $chan = lc $event->{to}->[0]; $::log->logg( $event ); $::db->logg( $event ) if defined $::db; - if (defined $::db and $event->{args}->[0] =~ /^requested by/) { + # Ignore channels that are +s and not monitored + if (defined $::db and $event->{args}->[0] =~ /^requested by/ and (not ((grep { /^s$/ } @{$::sc{$_}{modes}}) && ($::channels->{channel}->{$_}->{monitor} eq "no"))) ) { my $idx = $::db->actionlog( $event); $::log->sqlIncident($chan, $idx) if $idx; } @@ -406,7 +407,9 @@ sub on_quit $event->{to} = \@channels; if (defined $::db) { my $idx = $::db->actionlog($event); - $::log->sqlIncident( join(',', @channels), $idx ) if $idx; + # Ignore channels that are +s and not monitored + my @actionlog_channels = grep { not ((grep { /^s$/ } @{$::sc{$_}{modes}}) && ($::channels->{channel}->{$_}->{monitor} eq "no")) } @channels; + $::log->sqlIncident( join(',', @actionlog_channels), $idx ) if $idx; $::db->logg( $event ); } $::log->logg( $event ); @@ -536,8 +539,11 @@ sub on_kick { $::log->logg( $event ); if (defined $::db) { $::db->logg( $event ); - my $idx = $::db->actionlog($event); - $::log->sqlIncident($chan, $idx) if $idx; + # Ignore channels that are +s and not monitored + if( not ((grep { /^s$/ } @{$::sc{$chan}{modes}}) && ($::channels->{channel}->{$chan}->{monitor} eq "no")) ) { + my $idx = $::db->actionlog($event); + $::log->sqlIncident($chan, $idx) if $idx; + } } if (defined($::sn{$nick}) && defined($::sn{$nick}->{mship})) { my @mship = @{$::sn{$nick}->{mship}}; @@ -673,8 +679,11 @@ sub on_mode my @affected = whoGotHit($chan, $ex[1]); if ( defined($::db) && (@affected) && (scalar @affected <= 4) ) { foreach my $victim (@affected) { - my $idx = $::db->actionlog($event, 'ban', $victim); - $::log->sqlIncident( $chan, $idx ) if $idx; + # Ignore channels that are +s and not monitored + if ( not ((grep { /^s$/ } @{$::sc{$_}{modes}}) && ($::channels->{channel}->{$_}->{monitor} eq "no")) ) { + my $idx = $::db->actionlog($event, 'ban', $victim); + $::log->sqlIncident( $chan, $idx ) if $idx; + } } } if ($ex[1] =~ /^\*\!\*\@(.*)$/) { @@ -697,8 +706,11 @@ sub on_mode my @affected = whoGotHit($chan, $ex[1]); if ( defined($::db) && (@affected) && (scalar @affected <= 4) ) { foreach my $victim (@affected) { - my $idx = $::db->actionlog($event, 'quiet', $victim); - $::log->sqlIncident( $chan, $idx ) if $idx; + # Ignore channels that are +s and not monitored + if ( not ((grep { /^s$/ } @{$::sc{$_}{modes}}) && ($::channels->{channel}->{$_}->{monitor} eq "no")) ) { + my $idx = $::db->actionlog($event, 'quiet', $victim); + $::log->sqlIncident( $chan, $idx ) if $idx; + } } } if ($ex[1] =~ /^\*\!\*\@(.*)$/) { |
