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,13 +67,19 @@ class Fun(callbacks.Privmsg):
def outFilter(self, irc, msg):
if msg.command == 'PRIVMSG':
if msg.args[0] in self.outFilters:
s = msg.args[1]
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
msg = ircmsgs.IrcMsg(msg=msg, args=(msg.args[0], 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
_filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp',

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)
@ -126,6 +126,16 @@ class FunTest(ChannelPluginTestCase, PluginDocumentation):
self.assertResponse('rot13 foobar', '%s: foobar' % s)
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: