mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Slight bugfix in isCtcp.
This commit is contained in:
parent
93e9fa3180
commit
1932ed4d02
@ -213,7 +213,8 @@ def isCtcp(msg):
|
|||||||
"""Returns whether or not msg is a CTCP message."""
|
"""Returns whether or not msg is a CTCP message."""
|
||||||
return msg.command in ('PRIVMSG', 'NOTICE') and \
|
return msg.command in ('PRIVMSG', 'NOTICE') and \
|
||||||
msg.args[1].startswith('\x01') and \
|
msg.args[1].startswith('\x01') and \
|
||||||
msg.args[1].endswith('\x01')
|
msg.args[1].endswith('\x01') and \
|
||||||
|
len(msg.args[1]) >= 2
|
||||||
|
|
||||||
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"""
|
||||||
|
@ -147,6 +147,7 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
def testIsCtcp(self):
|
def testIsCtcp(self):
|
||||||
self.failUnless(ircmsgs.isCtcp(ircmsgs.privmsg('foo',
|
self.failUnless(ircmsgs.isCtcp(ircmsgs.privmsg('foo',
|
||||||
'\x01VERSION\x01')))
|
'\x01VERSION\x01')))
|
||||||
|
self.failIf(ircmsgs.isCtcp(ircmsgs.privmsg('foo', '\x01')))
|
||||||
|
|
||||||
def testIsActionFalseWhenNoSpaces(self):
|
def testIsActionFalseWhenNoSpaces(self):
|
||||||
msg = ircmsgs.IrcMsg('PRIVMSG #foo :\x01ACTIONfoobar\x01')
|
msg = ircmsgs.IrcMsg('PRIVMSG #foo :\x01ACTIONfoobar\x01')
|
||||||
|
Loading…
Reference in New Issue
Block a user