mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
I honestly cannot believe that this wasn't caught sooner.
This commit is contained in:
parent
3aedb305f9
commit
0cd0a44e7d
@ -220,7 +220,10 @@ def isCtcp(msg):
|
|||||||
def isAction(msg):
|
def isAction(msg):
|
||||||
"""A predicate returning true if the PRIVMSG in question is an ACTION"""
|
"""A predicate returning true if the PRIVMSG in question is an ACTION"""
|
||||||
if isCtcp(msg):
|
if isCtcp(msg):
|
||||||
return len(msg.args[1].split(None, 1)) == 2
|
s = msg.args[1]
|
||||||
|
payload = s[1:-1] # Chop off \x01.
|
||||||
|
command = payload.split(None, 1)[0]
|
||||||
|
return command == 'ACTION'
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -129,6 +129,12 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
for msg in msgs:
|
for msg in msgs:
|
||||||
self.failUnless(ircmsgs.isAction(msg))
|
self.failUnless(ircmsgs.isAction(msg))
|
||||||
|
|
||||||
|
def testIsActionIsntStupid(self):
|
||||||
|
m = ircmsgs.privmsg('#x', '\x01NOTANACTION foo\x01')
|
||||||
|
self.failIf(ircmsgs.isAction(m))
|
||||||
|
m = ircmsgs.privmsg('#x', '\x01ACTION foo bar\x01')
|
||||||
|
self.failUnless(ircmsgs.isAction(m))
|
||||||
|
|
||||||
def testIsCtcp(self):
|
def testIsCtcp(self):
|
||||||
self.failUnless(ircmsgs.isCtcp(ircmsgs.privmsg('foo',
|
self.failUnless(ircmsgs.isCtcp(ircmsgs.privmsg('foo',
|
||||||
'\x01VERSION\x01')))
|
'\x01VERSION\x01')))
|
||||||
|
Loading…
Reference in New Issue
Block a user