diff -r df2a6780cdf9 -r 74f6a0b01ddf log_parser.py --- a/log_parser.py Wed Feb 11 01:00:18 2009 +0200 +++ b/log_parser.py Wed Feb 11 01:21:22 2009 +0200 @@ -51,7 +51,9 @@ _TS = r'(?P\S+)' _NICK = r'(?P.+?)' _NICK2 = r'(?P.+?)' + _TARGET = r'(?P.+?)' _CHAN = r'(?P.+?)' + _CHAN2 = r'(?P.+?)' _USERHOST = r'(?P.*?)@(?P.*?)' _MSG = r'(?P.*)' @@ -64,14 +66,14 @@ ( LogTypes.ACTION, _TS + r' \* ' + _NICK + ' ' + _MSG ), ( LogTypes.JOIN, _TS + r' -!- ' + _NICK + ' \[' + _USERHOST + '\] has joined ' + _CHAN ), ( LogTypes.PART, _TS + r' -!- ' + _NICK + ' \[' + _USERHOST + '\] has left ' + _CHAN + ' \[(?P.*?)\]' ), - ( LogTypes.KICK, _TS + r' -!- ' + _NICK2 + ' was kicked from ' + _CHAN + ' by ' + _NICK + ' \[(?P.*?)\]' ), + ( LogTypes.KICK, _TS + r' -!- ' + _TARGET + ' was kicked from ' + _CHAN + ' by ' + _NICK + ' \[(?P.*?)\]' ), ( LogTypes.MODE, _TS + r' -!- mode/' + _CHAN + ' \[(?P.+?)\] by (?P\S+)' ), - ( LogTypes.NICK, _TS + r' -!- ' + _NICK + ' is now known as (?P\S+)' ), + ( LogTypes.NICK, _TS + r' -!- ' + _NICK + ' is now known as (?P\S+)' ), ( LogTypes.QUIT, _TS + r' -!- ' + _NICK + ' \[' + _USERHOST + '\] has quit \[(?P.*?)\]' ), - ( LogTypes.TOPIC, _TS + r' -!- ' + _NICK + ' changed the topic of ' + _CHAN + ' to: (?P.*)' ), + ( LogTypes.TOPIC, _TS + r' -!- (' + _NICK + ' changed the topic of ' + _CHAN + ' to: (?P.*)|Topic unset by ' + _NICK2 + ' on ' + _CHAN2 + ')' ), ( LogTypes.SELF_NOTICE, _TS + r' \[notice\(' + _CHAN + '\)\] ' + _MSG ), - ( LogTypes.SELF_NICK, _TS + r' -!- You\'re now known as (?P\S+)' ), + ( LogTypes.SELF_NICK, _TS + r' -!- You\'re now known as (?P\S+)' ), ) # precompile @@ -127,11 +129,14 @@ # now localize with timezone dtz = self.tz.localize(dt) + # channel, currently unused + channel_name = (groups.get('channel') or groups.get('channel2')) + # source - source = (groups.get('nickname'), groups.get('username'), groups.get('hostname'), groups.get('flags')) + source = (groups.get('nickname') or groups.get('nickname2'), groups.get('username'), groups.get('hostname'), groups.get('flags')) # target - target = groups.get('nickname2') + target = groups.get('target') # data if 'message' in groups :