mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-16 13:40:50 +01:00
Fix crash when calling .reply(..., action=True) on ReplyIrcProxy
instead of on NestedCommandIrcProxy. ReplyIrcProxy._sendReply expects action=True to imply noLengthCheck=True, but only NestedCommandIrcProxy.reply() enforces the latter, not ReplyIrcProxy.reply(). This crash was introduced in 3c1c4a69e9927bcc7265b1d77fd1ab49cb55090e by moving NestedCommandIrcProxy's .reply() to ReplyIrcProxy.
This commit is contained in:
parent
054ee6e410
commit
2b4c5eb78f
@ -733,6 +733,9 @@ class ReplyIrcProxy(RichReplyMethods):
|
|||||||
kwargs['target'] = kwargs.get('to', None) or msg.args[0]
|
kwargs['target'] = kwargs.get('to', None) or msg.args[0]
|
||||||
if 'prefixNick' not in kwargs:
|
if 'prefixNick' not in kwargs:
|
||||||
kwargs['prefixNick'] = self._defaultPrefixNick(msg)
|
kwargs['prefixNick'] = self._defaultPrefixNick(msg)
|
||||||
|
if kwargs.get("action"):
|
||||||
|
kwargs["prefixNick"] = False
|
||||||
|
kwargs["noLengthCheck"] = True
|
||||||
self._sendReply(s, msg=msg, **kwargs)
|
self._sendReply(s, msg=msg, **kwargs)
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
|
@ -684,12 +684,26 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
|||||||
irc.reply('foo', action=True)
|
irc.reply('foo', action=True)
|
||||||
irc.reply('bar') # We're going to check that this isn't an action.
|
irc.reply('bar') # We're going to check that this isn't an action.
|
||||||
|
|
||||||
|
def doNotice(self, irc, msg):
|
||||||
|
irc.reply('foo', action=True)
|
||||||
|
irc.reply('bar') # We're going to check that this isn't an action.
|
||||||
|
|
||||||
def testNotActionSecondReply(self):
|
def testNotActionSecondReply(self):
|
||||||
self.irc.addCallback(self.TwoRepliesFirstAction(self.irc))
|
self.irc.addCallback(self.TwoRepliesFirstAction(self.irc))
|
||||||
self.assertAction('testactionreply', 'foo')
|
self.assertAction('testactionreply', 'foo')
|
||||||
m = self.getMsg(' ')
|
m = self.getMsg(' ')
|
||||||
self.assertFalse(m.args[1].startswith('\x01ACTION'))
|
self.assertFalse(m.args[1].startswith('\x01ACTION'))
|
||||||
|
|
||||||
|
def testNotActionSecondReplyNotCommand(self):
|
||||||
|
"""Same as testNotActionSecondReply, but tests ReplyIrcProxy instead of
|
||||||
|
NestedCommandsIrcProxy."""
|
||||||
|
self.irc.addCallback(self.TwoRepliesFirstAction(self.irc))
|
||||||
|
self.irc.feedMsg(ircmsgs.notice(self.channel, 'test action reply',
|
||||||
|
prefix=self.prefix))
|
||||||
|
self.assertAction(' ', 'foo')
|
||||||
|
m = self.getMsg(' ')
|
||||||
|
self.assertFalse(m.args[1].startswith('\x01ACTION'))
|
||||||
|
|
||||||
def testEmptyNest(self):
|
def testEmptyNest(self):
|
||||||
try:
|
try:
|
||||||
conf.supybot.reply.whenNotCommand.set('True')
|
conf.supybot.reply.whenNotCommand.set('True')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user