Procházet zdrojové kódy

* Added support for supybot logfiles,set format to 'supy'. (thanks, Jerome
Kerdreux)
* Vision support wasn't being included with the tarball. Fixed.

Morten Brix Pedersen před 22 roky
rodič
revize
c583ce6897
4 změnil soubory, kde provedl 119 přidání a 0 odebrání
  1. 2 0
      Makefile
  2. 3 0
      docs/Changelog
  3. 7 0
      docs/FORMATS
  4. 107 0
      modules/Pisg/Parser/Format/supy.pm

+ 2 - 0
Makefile

@@ -78,7 +78,9 @@ FORMAT_MODULES = $(MODULESDIR)/Pisg/Parser/Format/axur.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/pircbot.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/psybnc.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/sirc.pm \
+		 $(MODULESDIR)/Pisg/Parser/Format/supy.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/virc98.pm \
+		 $(MODULESDIR)/Pisg/Parser/Format/Vision.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/Trillian.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/Template.pm \
 		 $(MODULESDIR)/Pisg/Parser/Format/RacBot.pm \

+ 3 - 0
docs/Changelog

@@ -1,6 +1,9 @@
 pisg (x.xx)
    * Fix wrong counting of most referenced nicks.
    * Remove devel-code that appeared in 0.52 pisg.cfg.
+   * Added support for supybot logfiles,set format to 'supy'. (thanks, Jerome
+   Kerdreux)
+   * Vision support wasn't being included with the tarball. Fixed.
 
 pisg (0.52) - Fri Feb, 13rd 2004
    * Fixed a bug in the energymech format, it did not recognize join lines.

+ 7 - 0
docs/FORMATS

@@ -472,3 +472,10 @@ preferences you
                                                                                 
  - In order to use this, format must be set to 'Vision'
 
+* Supybot:
+  - http://supybot.sf.net
+  - Version tested with 0.77
+  - Log format :
+   normal msg:  [05-Mar-2004 17:28:10]  * Jkx|home bon je vais pas trainer ..
+   channel msg: [17-Feb-2004 08:13:47]  *** Jkx changes topic to "Oh my god of topic
+

+ 107 - 0
modules/Pisg/Parser/Format/supy.pm

@@ -0,0 +1,107 @@
+package Pisg::Parser::Format::supy;
+
+# pisg log parser for supybot bot
+# http://supybot.sf.net
+# Copyright Jerome Kerdreux / Licence GPL 
+# contact Jerome.Kerdreux@finix.eu.org for more information
+
+# This module supports both the old and new logformat (after 1.8.7)
+
+
+use strict;
+$^W = 1;
+
+sub new
+{
+    my ($type, %args) = @_;
+    my $self = {
+        cfg => $args{cfg},
+	# [12-Feb-2004 16:59:42]  <philipss> plop
+	normalline => '^\[\d+-\w+-\d+ (\d+):\d+:\d+]  <(\S+)> (.*)',
+	# [05-Mar-2004 17:28:10]  * Jkx|home bon je vais pas trainer ..
+        actionline => '^\[\d+-\w+-\d+ (\d+):\d+:\d+]  \* (\S+) (.*)',
+	# [17-Feb-2004 08:13:47]  *** Jkx changes topic to "Oh my god of topic"
+        thirdline  => '\[\d+-\w+-\d+ (\d+):(\d+):\d+]  \*\*\* (\S+) (\S+) (\S+) (\S+) ?(.*)?',
+    };
+
+    bless($self, $type);
+    return $self;
+}
+
+sub normalline
+{
+    my ($self, $line, $lines) = @_;
+    my %hash;
+
+    if ($line =~ /$self->{normalline}/o) {
+        $hash{hour} = $1;
+        $hash{nick} = $2;
+        $hash{saying} = $3;
+
+        return \%hash;
+    } else {
+        return;
+    }
+}
+
+sub actionline
+{
+    my ($self, $line, $lines) = @_;
+    my %hash;
+
+    if ($line =~ /$self->{actionline}/o) {
+
+        $hash{hour} = $1;
+        $hash{nick} = $2;
+        $hash{saying} = $3;
+
+        return \%hash;
+    } else {
+        return;
+    }
+}
+
+sub thirdline
+{
+    my ($self, $line, $lines) = @_;
+    my %hash;
+
+    if ($line =~ /$self->{thirdline}/o) {
+
+	$hash{hour} = $1;
+        $hash{min} = $2;
+        $hash{nick} = $3;
+
+	
+	
+	# print "*** 1/$1 2/$2 3/$3 4/$4 5/$5 6/$6 7/$7 ***\n";
+
+	# all action are catched except nick change because 
+	# there aren't in the logfile :( 
+	
+        if (($4.$5) eq 'waskicked') {
+            $hash{kicker} = $7;
+            $hash{nick} = $3;
+
+        } elsif (($4.$5) eq 'changestopic') {
+            $hash{newtopic} = $7;
+	} elsif (($4.$5) eq 'setsmode:') {
+            $hash{newmode} = $6;
+
+        } elsif (($4.$5) eq 'hasjoined') {
+            $hash{newjoin} = $3;
+
+        } 
+	
+	
+
+	# print %hash;
+	# print "\n";
+        return \%hash;
+
+    } else {
+        return;
+    }
+}
+
+1;