diff options
| author | 2015-03-07 01:45:14 +0400 | |
|---|---|---|
| committer | 2015-03-07 01:45:14 +0400 | |
| commit | 1fd649a552dbd8910bb79f83163f4a4fdf832d65 (patch) | |
| tree | 67fb0c99fec8e3841eacde66ef87f8a7ffc20bf3 | |
| parent | 0015ac246c75892fa43183e30396031e732a3a48 (diff) | |
Add some checks for STATUSMSG prefixes on channels
This un-breaks /msg +#channel hi, mostly.
| -rw-r--r-- | modules/event.pl | 5 | ||||
| -rw-r--r-- | modules/log.pl | 4 | ||||
| -rw-r--r-- | modules/util.pl | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/modules/event.pl b/modules/event.pl index 05003eb..a1f84de 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -12,6 +12,7 @@ use HTTP::Request; sub cs { my ($chan) = @_; $chan = lc $chan; + $chan =~ s/^[@+]//; return $::channels->{channel}->{$chan} if ( defined($::channels->{channel}->{$chan}) ); return $::channels->{channel}->{default}; } @@ -329,7 +330,9 @@ sub on_public { my ($conn, $event) = @_; # alarm 200; - $::sc{lc $event->{to}->[0]}{users}{lc $event->{nick}}{msgtime} = time; + my $chan = lc $event->{to}[0]; + $chan =~ s/^[+@]//; + $::sc{$chan}{users}{lc $event->{nick}}{msgtime} = time; $::log->logg( $event ); $::db->logg( $event ); if ($event->{args}->[0] =~ /(https?:\/\/bitly.com\/\w+|https?:\/\/bit.ly\/\w+|https?:\/\/j.mp\/\w+|https?:\/\/tinyurl.com\/\w+)/i) { diff --git a/modules/log.pl b/modules/log.pl index 72e0972..c2a2b72 100644 --- a/modules/log.pl +++ b/modules/log.pl @@ -60,9 +60,7 @@ sub logg { $chan = lc $chan; next if ($chan eq '$$*'); - if (substr($chan, 0, 1) eq '@') { - $chan = substr($chan, 1); - } + $chan =~ s/^[@+]//; if ($chan eq '*') { ASM::Util->dprint("$event->{nick}: $event->{args}->[0]", 'snotice'); next; diff --git a/modules/util.pl b/modules/util.pl index dfb715b..cb66919 100644 --- a/modules/util.pl +++ b/modules/util.pl @@ -70,6 +70,7 @@ sub maxlen { sub cs { my ($module, $chan) = @_; $chan = lc $chan; + $chan =~ s/^[@+]//; return $::channels->{channel}->{default} unless defined($::channels->{channel}->{$chan}); if ( defined($::channels->{channel}->{$chan}->{link}) ) { return $::channels->{channel}->{ $::channels->{channel}->{$chan}->{link} }; @@ -81,6 +82,7 @@ sub getLink { my ($module, $chan) = @_; $chan = lc $chan; + $chan =~ s/^[@+]//; my $link = $::channels->{channel}->{$chan}->{link}; if ( defined($link) ) { return $link; @@ -92,6 +94,7 @@ sub speak { my ($module, $chan) = @_; $chan = lc $chan; + $chan =~ s/^[@+]//; if ( defined($::channels->{channel}->{$chan}->{silence}) ) { if ($::channels->{channel}->{$chan}->{silence} eq "no") { return 1; @@ -134,6 +137,7 @@ sub getAlert { my @disable = (); my @x = (); $c = lc $c; + $c =~ s/^[@+]//; foreach my $prisk ( keys %::RISKS) { if ( $::RISKS{$risk} >= $::RISKS{$prisk} ) { push( @x, @{$::channels->{channel}->{master}->{$t}->{$prisk}} ) if defined $::channels->{channel}->{master}->{$t}->{$prisk}; |
