Просмотр исходного кода

perlbot support added by "Travis Roy" <travis@scootz.net>

Morten Brix Pedersen 24 лет назад
Родитель
Сommit
366d012cee
4 измененных файлов с 121 добавлено и 1 удалено
  1. 4 1
      docs/CREDITS
  2. 2 0
      docs/Changelog
  3. 14 0
      docs/FORMATS
  4. 101 0
      modules/Pisg/Parser/Format/perlbot.pm

+ 4 - 1
docs/CREDITS

@@ -90,7 +90,10 @@ And all the other contributors:
    | winbot logfile support, Trillian logfile support
    | winbot logfile support, Trillian logfile support
  * Andrew <andy@lewman.com>
  * Andrew <andy@lewman.com>
    | axur logfile support
    | axur logfile support
-
+ * EQU <equ@equnet.org>
+   | oer logfile support
+ * "Travis Roy" <travis@scootz.net>
+   | perlbot logfile support
 
 
 I probably forgot a lot of people here, _PLEASE_ notify me if I left you
 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 :)
 out.. because I have a bad habit of forgetting to maintain this list :)

+ 2 - 0
docs/Changelog

@@ -9,6 +9,8 @@ pisg (0.34) - Tue, Jan 8th 2002
    * bobot++ logfile support added (thanks to Oct@zoy.org)
    * bobot++ logfile support added (thanks to Oct@zoy.org)
    * New option 'nickhistory' to define the maximum number of nicks in 'most
    * New option 'nickhistory' to define the maximum number of nicks in 'most
      referenced nicks' (as suggested by Zapp <box@uni.de>)
      referenced nicks' (as suggested by Zapp <box@uni.de>)
+   * Support for oer bot logfiles (thanks to EQU <equ@equnet.org>)
+   * Support for perlbot logfiles (thanks to Travis Roy <travis@scootz.net>)
    * The usual slew of translation updates
    * The usual slew of translation updates
 
 
 pisg (0.33) - Tue, Dec 20th 2001
 pisg (0.33) - Tue, Dec 20th 2001

+ 14 - 0
docs/FORMATS

@@ -172,3 +172,17 @@ link to the logfile)
   [MM/DD/YYYY @ HH:MM:SS] >* logger does some action here
   [MM/DD/YYYY @ HH:MM:SS] >* logger does some action here
 
 
   Both is supported.
   Both is supported.
+
+* Perlbot:
+  - A bot which written in perl that supports loadable modules
+    (http://perlbot.sourceforge.net)
+  - It also has some modules for searching logs and some perl scripts
+    for searching and browsing the log files.
+    (See examples at http://stats.978.org)
+  - Development on the bot seems to have stopped. I did need to edit it
+    a bit to get it to log actions correctly.
+
+  - In order to use this, format must be set to 'perlbot'
+
+  Example:
+        13:22:57 <Sc00ter> bah, gotta run to the store

+ 101 - 0
modules/Pisg/Parser/Format/perlbot.pm

@@ -0,0 +1,101 @@
+package Pisg::Parser::Format::perlbot;
+
+# Documentation for the Pisg::Parser::Format modules is found in Template.pm
+
+use strict;
+$^W = 1;
+
+sub new
+{
+    my ($type, %args) = @_;
+    my $self = {
+        cfg => $args{cfg},
+        normalline => '^(\d+):\d+:\d+[^ ]+ <([^>]+)> (.*)',
+        actionline => '^(\d+):\d+:\d+[^ ]+ \* (\S+) (.*)',
+        thirdline  => '^(\d+):(\d+):\d+[^ ]+ (\S+) (\S+) (\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}   = remove_prefix($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}   = remove_prefix($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} = remove_prefix($4);
+
+        if (($3) eq '[KICK]') {
+            $hash{kicker} = $8;
+
+        } elsif ($3 eq '[TOPIC]') {
+            $hash{newtopic} = "$5 $6 $7 $8 $9";
+
+        } elsif (($3) eq '[MODE]') {
+            $hash{newmode} = $7;
+
+        } elsif (($5) eq 'joined') {
+            $hash{newjoin} = $3;
+
+        } elsif (($3) eq '[NICK]') {
+            $hash{newnick} = $8;
+        }
+
+        return \%hash;
+
+    } else {
+        return;
+    }
+}
+
+sub remove_prefix
+{
+    my $str = shift;
+
+    $str =~ s/^@//;
+    $str =~ s/^\+//;
+
+    return $str;
+
+}
+
+1;