[Pymoul-svn] SF.net SVN: pymoul: [293] pymoul/trunk/src/moul
Status: Alpha
Brought to you by:
tiran
|
From: <ti...@us...> - 2007-05-24 17:53:50
|
Revision: 293
http://pymoul.svn.sourceforge.net/pymoul/?rev=293&view=rev
Author: tiran
Date: 2007-05-24 10:53:52 -0700 (Thu, 24 May 2007)
Log Message:
-----------
Fixed misc bugs in the formatter and writer
Modified Paths:
--------------
pymoul/trunk/src/moul/chatrelay/io.py
pymoul/trunk/src/moul/chatrelay/ircclient.py
pymoul/trunk/src/moul/file/chatlog.py
Modified: pymoul/trunk/src/moul/chatrelay/io.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:41:19 UTC (rev 292)
+++ pymoul/trunk/src/moul/chatrelay/io.py 2007-05-24 17:53:52 UTC (rev 293)
@@ -40,16 +40,22 @@
self.skipprivate = skipprivate
def format(self, msg):
- if self.skipprivate and msg.typ & CHAT_PRIVMSG:
- result = None
- elif msg.typ == CHAT_PRIVMSGTO:
- result = "-> %s" % msg
- elif msg.typ == CHAT_PRIVMSGFROM:
- result = "<- %s" % msg
- elif msg.typ == CHAT_ACTION:
- result = "* %s" % msg
- if msg.important:
- result = "%B%s" msg
+ print msg.typ, msg
+ if not msg:
+ return None
+ typ = getattr(msg, 'typ', CHAT_UNKNOWN)
+ important = getattr(msg, 'important', False)
+
+ if self.skipprivate and typ & CHAT_PRIVMSG:
+ return None
+ elif typ == CHAT_PRIVMSGTO:
+ msg = "-> %s" % msg
+ elif typ == CHAT_PRIVMSGFROM:
+ msg = "<- %s" % msg
+ elif typ == CHAT_ACTION:
+ msg = "* %s" % msg
+ if important:
+ msg = "%B%s" % msg
return str(msg)
class LogFileReader(object):
Modified: pymoul/trunk/src/moul/chatrelay/ircclient.py
===================================================================
--- pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 17:41:19 UTC (rev 292)
+++ pymoul/trunk/src/moul/chatrelay/ircclient.py 2007-05-24 17:53:52 UTC (rev 293)
@@ -33,6 +33,7 @@
from moul.chatrelay.io import MessageWriter
from moul.chatrelay.io import LogFileReader
+from moul.chatrelay.io import MOULLogFormatter
from moul.osdependent import getMoulUserDataDir
datadir = getMoulUserDataDir()
@@ -299,7 +300,7 @@
self.adminpasswd)
p.factory = self
p.reader = self.readerClass(chatlog)
- p.writer = self.writerClass(p, self.channel)
+ p.writer = self.writerClass(p, self.channel, formatter=MOULLogFormatter(False))
self.p = p
return p
Modified: pymoul/trunk/src/moul/file/chatlog.py
===================================================================
--- pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:41:19 UTC (rev 292)
+++ pymoul/trunk/src/moul/file/chatlog.py 2007-05-24 17:53:52 UTC (rev 293)
@@ -384,7 +384,7 @@
typ = t
info = mo.groupdict()
break
- if typ is None:
+ if typ == CHAT_UNKNOWN: # XXX check this
typ = CHAT_ACTION
for user in USER_IMPORTANT:
if user in msg:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|