diff options
| author | 2014-05-31 16:47:24 +0400 | |
|---|---|---|
| committer | 2014-05-31 16:47:24 +0400 | |
| commit | 15f06dc6f79d4642f41f93231d752e6e2e79ccaf (patch) | |
| tree | 45cbd477359b9a6f4c311c8860bf43945cf27ab5 | |
| parent | a36dd828d46c4f02ef447a7773a768839197b02d (diff) | |
Tweaks to commands, better nickspam detection
| -rw-r--r-- | config-default/commands.xml | 27 | ||||
| -rw-r--r-- | modules/classes.pl | 2 |
2 files changed, 23 insertions, 6 deletions
diff --git a/config-default/commands.xml b/config-default/commands.xml index a36ba60..8ef69b4 100644 --- a/config-default/commands.xml +++ b/config-default/commands.xml @@ -1,4 +1,20 @@ <commands> + <command cmd=";wallop" flag="d"> + <![CDATA[ + my @chans = (); + foreach my $chan (keys %{$::channels->{channel}}) { + if (defined($::channels->{channel}->{$chan}->{msgs})) { + foreach my $risk (keys %{$::channels->{channel}->{$chan}->{msgs}}) { + push @chans, @{$::channels->{channel}->{$chan}->{msgs}->{$risk}}; + } + } + } + my %uniq = (); + foreach my $chan (@chans) { $uniq{$chan} = 1; } + @chans = keys(%uniq); + print Dumper(\@chans); + ]]> + </command> <command cmd="^;;addwebuser (\S+)" flag="s"> <![CDATA[ my $pass = $1; @@ -169,7 +185,7 @@ ((lc $person->{gecos} ~~ $::mysql->{ignoredgecos}) ? '' : '&gecos=' . uri_escape($person->{gecos})) . $dq . ' )'); ]]> </command> - <command cmd="^;investigate2 (\S+) ?(\d*)$" flag="s"> + <command cmd="^;investigate2 (\S+) ?(\d*) *$" flag="s"> <![CDATA[ my $nick = lc $1; my $skip = 0; @@ -263,10 +279,11 @@ $conn->privmsg($event->replyto, "I'm assuming you mean " . $nick . "'s nickserv account, " . lc $::sn{$nick}->{account} . '.'); $nick = lc $::sn{$nick}->{account}; } + my $sayNick = substr($nick, 0, 1) . "\x02\x02" . substr($nick, 1); if (defined($::users->{person}->{$nick}->{flags})) { - $conn->privmsg($event->replyto, "Flags for $nick: $::users->{person}->{$nick}->{flags}"); + $conn->privmsg($event->replyto, "Flags for $sayNick: $::users->{person}->{$nick}->{flags}"); } else { - $conn->privmsg($event->replyto, "$nick has no flags"); + $conn->privmsg($event->replyto, "$sayNick has no flags"); } ]]> </command> @@ -581,8 +598,8 @@ "\x02($event->{nick} plugin)\x02 - ${reason}; ping "; $txtz = $txtz . ASM::Util->commaAndify(ASM::Util->getAlert(lc $chan, $risk, 'hilights')) if (ASM::Util->getAlert(lc $chan, $risk, 'hilights')); $txtz = $txtz . ' !att-' . $chan . '-' . $risk; - my @tgts = ASM::Util->getAlert($chan, $risk, 'msgs'); - ASM::Util->sendLongMsg(\@tgts, $txtz); + my @tgts = ASM::Util->getAlert(lc $chan, $risk, 'msgs'); + ASM::Util->sendLongMsg($conn, \@tgts, $txtz); ]]> </command> <command cmd="^;sync (\S+)" flag="a"> diff --git a/modules/classes.pl b/modules/classes.pl index 5cafdbd..2d580b3 100644 --- a/modules/classes.pl +++ b/modules/classes.pl @@ -271,7 +271,7 @@ sub nickspam { if ( length $event->{args}->[0] >= int($cut[0]) ) { my %users = %{$::sc{lc $chan}->{users}}; my %x = map { $_=>$_ } keys %users; - my @uniq = grep( $x{$_}, split( /[ ,]+/ , lc $event->{args}->[0]) ); + my @uniq = grep( $x{$_}, split( /[^a-zA-Z0-9_\\|`[\]{}^-]+/ , lc $event->{args}->[0]) ); return 1 if ( @uniq >= int($cut[1]) ); } return 0; |
