diff -r df2a6780cdf9 -r 74f6a0b01ddf log_line.py --- a/log_line.py Wed Feb 11 01:00:18 2009 +0200 +++ b/log_line.py Wed Feb 11 01:21:22 2009 +0200 @@ -41,41 +41,45 @@ ('LOG_CLOSE', 0x03), ## messages - # normal message + # sent message to ('MSG', 0x10), - # notice + # sent notice with message to ('NOTICE', 0x11), - # CTCP action + # sent CTCP action with message to ('ACTION', 0x12), ## user-channel stats - # join + # joined ('JOIN', 0x21), - # part + # left with message ('PART', 0x22), - # kick + # kicked from with message ('KICK', 0x25), - # channel modes + # changed modes on with modestring ('MODE', 0x26), ## user status - # nick-change + # changed nickname to ('NICK', 0x31), - # quit + # quit the network with quit-message ('QUIT', 0x32), ## general channel status - # topic changed + # changed the topic of to + # data may be None if the topic was unset ('TOPIC', 0x41), ## our own actions + # we () sent a notice with message to ('SELF_NOTICE', 0x51), + + # we () changed nickname to ('SELF_NICK', 0x52), ] @@ -108,10 +112,10 @@ # the UTC timestamp of the event timestamp = None - # the event source, this should be a + # the source, this should be a (nickname, username, hostname, chanflags) tuple source = None - # possible event target, for certain types (kick, nick) + # possible target nickname for certain types (kick, nick) target = None # associated data (message, etc) @@ -139,7 +143,9 @@ def format_source (self) : """ - Formats source as [][][!][@], omitting those parts that are missing + Formats source as [][][!][@], omitting those parts that are missing. + + If all parts are None, this returns the empty string """ nick, user, host, flags = self.source @@ -150,6 +156,17 @@ '!' + user if user else '', '@' + host if host else '' ) + + def __str__ (self) : + return '\t'.join(( + self.channel.name, + str(self.offset), + self.format_type(), + str(self.timestamp), + self.format_source(), + str(self.target), + str(self.data) + )) def __repr__ (self) : return "LogLine(%r, %s, %-12s, %s, %-35s, %-10s, %r)" % (