Explorar el Código

Patch by Phil Gregory to enable regex support in wildcards

Morten Brix Pedersen hace 25 años
padre
commit
1dcb67585a
Se han modificado 4 ficheros con 16 adiciones y 4 borrados
  1. 5 2
      CONFIG-README
  2. 2 0
      CREDITS
  3. 4 0
      Changelog
  4. 5 2
      pisg.pl

+ 5 - 2
CONFIG-README

@@ -141,6 +141,9 @@ ignorewords          A space seperated list of words to ignore in 'most
 foul                 Space seperated list of words considered to be 'foul'
                      language, look in the bottom for a better explanation.
 
+regexp_alises        1 or 0, enabling this will make aliases in <user> tags
+                     regex-able.
+
  * Colors / layout for your stats page *
 
 bgcolor              Background color of the page
@@ -176,8 +179,8 @@ wordlength           The minimum number of chars an interesting word may be
 activenicks          Number of nicks to show in the 'top 25'
 activenicks2         Nicks to show in 'these didnt make it...'
 topichistory         How many topics to show in 'latest topics'
-nicktracking         Track nickchanges and create aliases (can be slow, so
-                     it's disabled by default)
+nicktracking         Track nickchanges and create aliases [1 or 0, enabled
+                     by default]
 
 
 

+ 2 - 0
CREDITS

@@ -61,6 +61,8 @@ And all the other contributors:
    | Language specific dates on stats page
  * Christian Legler <capt@capt.de>
    | New images for pisg
+ * Phil Gregory <phil_g@pobox.com>
+   | Regex support in user aliases
 
 I probably forgot a lot of people here, _PLEASE_ notify me if I left you
 out.. because I have a bad habit of forgetting to maintain this list :)

+ 4 - 0
Changelog

@@ -1,3 +1,7 @@
+pisg (0.22)
+   * pisg.cfg now supports regexs in user.cfg when 'regexp_aliases' is
+     enabled.
+
 pisg (0.21) - Mon, Aug 27th 2001
    * Fix stupid legend bug; 0-6 should be 0-5, and 7-11 should be 6-11.
    * Added "Most referenced URLs".

+ 5 - 2
pisg.pl

@@ -98,6 +98,7 @@ my $conf = {
     foul => 'ass fuck bitch shit scheisse scheiße kacke arsch ficker ficken schlampe',
     ignorewords => '',
     tablewidth => 614,
+    regexp_aliases => 0,
 
     # Developer stuff
 
@@ -315,8 +316,10 @@ sub init_config
                 if ($line =~ /alias="([^"]+)"/) {
                     my @thisalias = split(/\s+/, lc($1));
                     foreach (@thisalias) {
-                        if ($_ =~ s/\*/\.\*/g) {
-                            $_ =~ s/([\[\]\{\}\-\^])/\\$1/g; # quote it if it is a wildcard
+		        if ($conf->{regexp_aliases} and $_ =~ /[\[\]\{\}\(\)\?\+\.\*\^\\]/) {
+                            $conf->{aliaswilds}{$_} = $nick;
+                        } elsif (not $conf->{regexp_aliases} and $_ =~ s/\*/\.\*/g) {
+                            $_ =~ s/([\[\]\{\}\(\)\?\+\^\\])/\\$1/g; # quote it if it is a wildcard
                             $conf->{aliaswilds}{$_} = $nick;
                         } else {
                             $alias{$_} = $nick;