summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2015-12-25 06:36:45 +0400
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2015-12-25 06:36:45 +0400
commitd98a177951a4f039fbf104a44383070741c801bf (patch)
treed498d4be2d9a20303cf24bf27aeb53c8b2842974
parent85615043fe4f8e76496f39c366ce40a4bbba92b7 (diff)
Allow nickserv accounts to be configured as hilights via $a:account
-rw-r--r--lib/ASM/Util.pm47
1 files changed, 43 insertions, 4 deletions
diff --git a/lib/ASM/Util.pm b/lib/ASM/Util.pm
index f9895a0..a13f673 100644
--- a/lib/ASM/Util.pm
+++ b/lib/ASM/Util.pm
@@ -140,12 +140,44 @@ sub getAlert {
$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};
- push( @x, @{cs($module, $c)->{$t}->{$prisk}} ) if defined cs($module, $c)->{$t}->{$prisk};
+ if (defined $::channels->{channel}->{master}->{$t}->{$prisk}) {
+ foreach my $nick (@{$::channels->{channel}->{master}->{$t}->{$prisk}}) {
+ if ($nick =~ /^\$a:/) {
+ push @x, @{accountToNicks($module, $nick)};
+ } else {
+ push @x, $nick;
+ }
+ }
+ }
+ if (defined cs($module, $c)->{$t}->{$prisk}) {
+ foreach my $nick (@{cs($module, $c)->{$t}->{$prisk}}) {
+ if ($nick =~ /^\$a:/) {
+ push @x, @{accountToNicks($module, $nick)};
+ } else {
+ push @x, $nick;
+ }
+ }
+ }
+ }
+ }
+ if (defined $::channels->{channel}->{master}->{$t}->{disable}) {
+ foreach my $nick (@{$::channels->{channel}->{master}->{$t}->{disable}}) {
+ if ($nick =~ /^\$a:/) {
+ push @disable, @{accountToNicks($module, $nick)};
+ } else {
+ push @disable, $nick;
+ }
+ }
+ }
+ if (defined cs($module, $c)->{$t}->{disable}) {
+ foreach my $nick (@{cs($module, $c)->{$t}->{disable}}) {
+ if ($nick =~ /^\$a:/) {
+ push @disable, @{accountToNicks($module, $nick)};
+ } else {
+ push @disable, $nick;
+ }
}
}
- push( @disable, @{$::channels->{channel}->{master}->{$t}->{disable}} ) if defined $::channels->{channel}->{master}->{$t}->{disable};
- push( @disable, @{cs($module, $c)->{$t}->{disable}} ) if defined cs($module, $c)->{$t}->{disable};
@x = unique(@x);
@x = array_diff(@x, @disable);
return @x;
@@ -294,4 +326,11 @@ sub notRestricted {
return 1;
}
+sub accountToNicks {
+ my ($module, $account) = @_;
+ $account =~ s/^\$a://;
+ my @ret = grep( { (lc ($account) eq lc ($::sn{$_}->{account})) } keys %::sn );
+ return \@ret;
+}
+
return 1;