Parcourir la source

Changed ignores to use a hash, also made them not call find_alias
-- we should have made sure we were calling it with the right nick already...
lower number of calls to find_alias

Sam

sbingner il y a 25 ans
Parent
commit
0e56d727e4
1 fichiers modifiés avec 8 ajouts et 7 suppressions
  1. 8 7
      modules/Pisg/Common.pm

+ 8 - 7
modules/Pisg/Common.pm

@@ -7,7 +7,7 @@ use Exporter;
 use strict;
 use strict;
 $^W = 1;
 $^W = 1;
 
 
-my (%aliases, %aliaswilds, @ignored);
+my (%aliases, %aliaswilds, %ignored);
 
 
 # add_alias assumes that the first argument is the true nick and the second is
 # add_alias assumes that the first argument is the true nick and the second is
 # the alias, but will accomidate other arrangements if necessary.
 # the alias, but will accomidate other arrangements if necessary.
@@ -46,18 +46,19 @@ sub add_aliaswild {
 }
 }
 
 
 sub add_ignore {
 sub add_ignore {
-    my ($nick) = @_;
-    push @ignored, find_alias($nick);
+    my $nick = shift;
+    $ignored{$nick} = 1;
 }
 }
 
 
 sub is_ignored {
 sub is_ignored {
-    my ($nick) = @_;
-    my $realnick = find_alias($nick);
-    return grep /^\Q$realnick\E$/, @ignored;
+    my $nick = shift;
+    if ($ignored{$nick}) {
+        return 1;
+    }
 }
 }
 
 
 sub find_alias {
 sub find_alias {
-    my $nick = shift;
+    my ($nick) = @_;
     my $lcnick = lc($nick);
     my $lcnick = lc($nick);
 
 
     if ($aliases{$lcnick}) {
     if ($aliases{$lcnick}) {