mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-06 01:24:05 +01:00
Fixed bug in isAction.
This commit is contained in:
parent
0cc2c2f49f
commit
966a09437c
@ -210,9 +210,11 @@ class IrcMsg(object):
|
||||
|
||||
def isAction(msg):
|
||||
"""A predicate returning true if the PRIVMSG in question is an ACTION"""
|
||||
return msg.command == 'PRIVMSG' and \
|
||||
msg.args[1].startswith('\x01ACTION') and \
|
||||
msg.args[1].endswith('\x01')
|
||||
if msg.command == 'PRIVMSG' and msg.args[1].endswith('\x01'):
|
||||
L = msg.args[1].split(None, 1)
|
||||
return len(L) == 2 and L[0] == '\x01ACTION'
|
||||
else:
|
||||
return False
|
||||
|
||||
_unactionre = re.compile(r'^\x01ACTION (.*)\x01$')
|
||||
def unAction(msg):
|
||||
|
@ -129,6 +129,10 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
for msg in msgs:
|
||||
self.failUnless(ircmsgs.isAction(msg))
|
||||
|
||||
def testIsActionFalseWhenNoSpaces(self):
|
||||
msg = ircmsgs.IrcMsg('PRIVMSG #foo :\x01ACTIONfoobar\x01')
|
||||
self.failIf(ircmsgs.isAction(msg))
|
||||
|
||||
def testUnAction(self):
|
||||
s = 'foo bar baz'
|
||||
msg = ircmsgs.action('#foo', s)
|
||||
|
Loading…
Reference in New Issue
Block a user