Added a squish command/outfilter.

This commit is contained in:
Jeremy Fincher 2003-11-13 20:24:40 +00:00
parent 93b16b79c2
commit f3e2e2a1ed
2 changed files with 14 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class Fun(callbacks.Privmsg):
_filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp', _filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp',
'scramble', 'morse', 'reverse', 'urlquote', 'md5','sha', 'scramble', 'morse', 'reverse', 'urlquote', 'md5','sha',
'colorize'] 'colorize', 'squish']
def outfilter(self, irc, msg, args, channel): def outfilter(self, irc, msg, args, channel):
"""[<channel>] [<command>] """[<channel>] [<command>]
@ -99,6 +99,15 @@ class Fun(callbacks.Privmsg):
irc.reply(msg, conf.replySuccess) irc.reply(msg, conf.replySuccess)
outfilter = privmsgs.checkChannelCapability(outfilter, 'op') outfilter = privmsgs.checkChannelCapability(outfilter, 'op')
def squish(self, irc, msg, args):
"""<text>
Removes all the spaces from <text>.
"""
text = privmsgs.getArgs(args)
text = ''.join(text.split())
irc.reply(msg, text)
def hexip(self, irc, msg, args): def hexip(self, irc, msg, args):
"""<ip> """<ip>

View File

@ -51,6 +51,10 @@ class FunTest(ChannelPluginTestCase, PluginDocumentation):
for i in range(100): for i in range(100):
self.assertNotError('jeffk the quick brown fox is ghetto') self.assertNotError('jeffk the quick brown fox is ghetto')
def testSquish(self):
self.assertResponse('squish foo bar baz', 'foobarbaz')
self.assertResponse('squish "foo bar baz"', 'foobarbaz')
def testLithp(self): def testLithp(self):
self.assertResponse('lithp jamessan', 'jamethan') self.assertResponse('lithp jamessan', 'jamethan')