Jelajahi Sumber

Hopefully remove @ and + from prefixs in mIRC logging

Morten Brix Pedersen 25 tahun lalu
induk
melakukan
4416e44fc8
1 mengubah file dengan 14 tambahan dan 3 penghapusan
  1. 14 3
      modules/Pisg/Parser/Format/mIRC.pm

+ 14 - 3
modules/Pisg/Parser/Format/mIRC.pm

@@ -29,7 +29,7 @@ sub normalline
         $self->{debug}->("[$lines] Normal: $1 $2 $3");
         $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
 
         $hash{hour}   = $1;
         $hash{hour}   = $1;
-        $hash{nick}   = $2;
+        $hash{nick}   = remove_prefix($2);
         $hash{saying} = $3;
         $hash{saying} = $3;
 
 
         return \%hash;
         return \%hash;
@@ -47,7 +47,7 @@ sub actionline
         $self->{debug}->("[$lines] Action: $1 $2 $3");
         $self->{debug}->("[$lines] Action: $1 $2 $3");
 
 
         $hash{hour}   = $1;
         $hash{hour}   = $1;
-        $hash{nick}   = $2;
+        $hash{nick}   = remove_prefix($2);
         $hash{saying} = $3;
         $hash{saying} = $3;
 
 
         return \%hash;
         return \%hash;
@@ -70,7 +70,7 @@ sub thirdline
 
 
         $hash{hour} = $1;
         $hash{hour} = $1;
         $hash{min}  = $2;
         $hash{min}  = $2;
-        $hash{nick} = $3;
+        $hash{nick} = remove_prefix($3);
 
 
         if (($4.$5) eq 'waskicked') {
         if (($4.$5) eq 'waskicked') {
             $hash{kicker} = $7;
             $hash{kicker} = $7;
@@ -95,4 +95,15 @@ sub thirdline
     }
     }
 }
 }
 
 
+sub remove_prefix
+{
+    my $str = shift;
+
+    $str =~ s/^@//;
+    $str =~ s/^\+//;
+
+    return $str;
+
+}
+
 1;
 1;