Jelajahi Sumber

Added winbot support -- had to make the cfg hash available in parsers for this, so I also changed the format of the calls to parsers slightly, more in line with the rest of the code this way anyways

sbingner 25 tahun lalu
induk
melakukan
7676a7f779

+ 3 - 2
modules/Pisg/Parser/Format/Template.pm

@@ -16,9 +16,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '',
         actionline => '',
         thirdline  => '',

+ 3 - 2
modules/Pisg/Parser/Format/bxlog.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^\[\d+ \S+\/(\d+):\d+\] <([^>]+)> (.*)',
         actionline => '^\[\d+ \S+\/(\d+):\d+\] \* (\S+) (.*)',
         thirdline => '^\[\d+ \S+\/(\d+):(\d+)\] ([<>@!]) (.*)'

+ 3 - 2
modules/Pisg/Parser/Format/eggdrop.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args->{cfg},
+        debug => $args->{debug},
         normalline => '^\[(\d+):\d+\] <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+\] Action: (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)\] (\S+) (\S+) (\S+) (\S+)(.*)',

+ 3 - 2
modules/Pisg/Parser/Format/grufti.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^\[(\d+):\d+\] <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+\] \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)\] (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',

+ 3 - 2
modules/Pisg/Parser/Format/irssi.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^(\d+):\d+ <[@+ ]?([^>]+)> (.*)',
         actionline => '^(\d+):\d+  \* (\S+) (.*)',
         thirdline  => '^(\d+):(\d+) -\!- (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',

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

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^\[(\d+):\d+[^ ]+ <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+[^ ]+ \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)[^ ]+ \*\*\* (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',

+ 3 - 2
modules/Pisg/Parser/Format/mbot.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^\S+ \S+ \d+ (\d+):\d+:\d+ \d+ <([^>]+)> (?!\001ACTION)(.*)',
         actionline => '^\S+ \S+ \d+ (\d+):\d+:\d+ \d+ <([^>]+)> \001ACTION (.*)\001$',
         thirdline  => '^\S+ \S+ \d+ (\d+):(\d+):\d+ \d+ (\S+) (\S+) ?(\S*) ?(\S*) ?(.*)',

+ 3 - 2
modules/Pisg/Parser/Format/psybnc.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^\d+-\d+-\d+-(\d+)-\d+-\d+:[^:]+::([^!]+)[^:]+:(.*)',
         actionline => '^\d+-\d+-\d+-(\d+)-\d+-\d+:[^:]+::([^!]+)[^:]+:\001ACTION (.*)',
         thirdline  => '^\d+-\d+-\d+-(\d+)-(\d+)-\d+:[^:]+::([^!]+)[^ ]+ (\w+) (.*)',

+ 3 - 2
modules/Pisg/Parser/Format/xchat.pm

@@ -7,9 +7,10 @@ $^W = 1;
 
 sub new
 {
-    my $type = shift;
+    my ($type, %args) = @_;
     my $self = {
-        debug => $_[0],
+        cfg => $args{cfg},
+        debug => $args{debug},
         normalline => '^(\d+):\d+:\d+ <([^>\s]+)>\s+(.*)',
         actionline => '^(\d+):\d+:\d+ \*\s+(\S+) (.*)',
         thirdline  => '^(\d+):(\d+):\d+ .--\s+(\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (.*)',

+ 4 - 1
modules/Pisg/Parser/Logfile.pm

@@ -38,7 +38,10 @@ sub _choose_format
     eval <<_END;
 use lib '$self->{cfg}->{modules_dir}';
 use Pisg::Parser::Format::$format;
-\$self->{parser} = new Pisg::Parser::Format::$format(\$self->{debug});
+\$self->{parser} = new Pisg::Parser::Format::$format(
+    debug => \$self->{debug},
+    cfg => \$self->{cfg},
+);
 _END
     if ($@) {
         print STDERR "Could not load parser for '$format': $@\n";