This commit is contained in:
Jeremy Fincher 2003-11-21 22:22:18 +00:00
parent 966a09437c
commit d83cf1450f
2 changed files with 19 additions and 3 deletions

View File

@ -67,12 +67,18 @@ class Fun(callbacks.Privmsg):
def outFilter(self, irc, msg):
if msg.command == 'PRIVMSG':
if msg.args[0] in self.outFilters:
if ircmsgs.isAction(msg):
s = ircmsgs.unAction(msg)
else:
s = msg.args[1]
methods = self.outFilters[msg.args[0]]
for filtercommand in methods:
myIrc = MyFunProxy()
filtercommand(myIrc, msg, [s])
s = myIrc.s
if ircmsgs.isAction(msg):
msg = ircmsgs.action(msg.args[0], s)
else:
msg = ircmsgs.IrcMsg(msg=msg, args=(msg.args[0], s))
return msg

View File

@ -114,7 +114,7 @@ class FunTest(ChannelPluginTestCase, PluginDocumentation):
self.assertNotRegexp('decode asdflkj foobar', 'LookupError')
self.assertResponse('decode zlib [encode zlib %s]' % s, s)
def testoutfilter(self):
def testOutfilter(self):
s = self.nick.encode('rot13')
self.assertNotError('outfilter rot13')
self.assertResponse('rot13 foobar', '%s: foobar' % s)
@ -127,5 +127,15 @@ class FunTest(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('outfilter')
self.assertResponse('rot13 foobar', 'sbbone')
def testOutfilterAction(self):
s = self.nick.encode('rot13')
self.assertNotError('outfilter rot13')
self.assertResponse('rot13 foobar', '%s: foobar' % s)
m = self.getMsg('action foobar')
self.failUnless(ircmsgs.isAction(m))
s = ircmsgs.unAction(m)
self.assertEqual(s, 'sbbone')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: