فهرست منبع

Support new xchat logfile format

Morten Brix Pedersen 24 سال پیش
والد
کامیت
1b81f45b74
2فایلهای تغییر یافته به همراه13 افزوده شده و 4 حذف شده
  1. 8 1
      docs/FORMATS
  2. 5 3
      modules/Pisg/Parser/Format/xchat.pm

+ 8 - 1
docs/FORMATS

@@ -34,9 +34,16 @@ link to the logfile)
     
   -  In order to use this, format must be set to 'xchat'.
 
-  Example:
+  Both the old logformat, and the new logformat from 1.8.7 and above is
+  supported.
+
+  Example of old logformat:
         18:01:43 <Ben> Hello world
 
+  Example of new logformat:
+        jan 13 04:39:42 <Ben> Hello World
+
+
 * Eggdrop:
   - A cool and advanced IRC bot for Linux (www.eggheads.org)
 

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

@@ -2,6 +2,8 @@ package Pisg::Parser::Format::xchat;
 
 # Documentation for the Pisg::Parser::Format modules is found in Template.pm
 
+# This module supports both the old and new logformat (after 1.8.7)
+
 use strict;
 $^W = 1;
 
@@ -10,9 +12,9 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        normalline => '^(\d+):\d+:\d+ <([^>\s]+)>\s+(.*)',
-        actionline => '^(\d+):\d+:\d+ \*\s+(\S+) (.*)',
-        thirdline  => '^(\d+):(\d+):\d+ .--\s+(\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (.*)',
+        normalline => '(\d+):\d+:\d+ <([^>\s]+)>\s+(.*)',
+        actionline => '(\d+):\d+:\d+ \*\s+(\S+) (.*)',
+        thirdline  => '(\d+):(\d+):\d+ .--\s+(\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (.*)',
     };
 
     bless($self, $type);