diff --git a/src/callbacks.py b/src/callbacks.py index c5bb261b1..2a5d570cd 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -737,9 +737,9 @@ class ReplyIrcProxy(RichReplyMethods): if msg is None: msg = self.msg if s: - m = _makeErrorReply(self, msg, s, **kwargs) - self.irc.queueMsg(m) - return m + msg.tag('isError') + kwargs['error'] = True + return self._replyFinal(msg, s, **kwargs) def reply(self, s, msg=None, **kwargs): if msg is None: @@ -1131,9 +1131,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): if not isinstance(self.irc, irclib.Irc): return self.irc.error(s, **kwargs) elif s: - m = _makeErrorReply(self, self.msg, s, **kwargs) - self.irc.queueMsg(m) - return m + return super(NestedCommandsIrcProxy, self).error(s, self.msg, **kwargs) def __getattr__(self, attr): return getattr(self.irc, attr) diff --git a/test/test_callbacks.py b/test/test_callbacks.py index 87df01b4e..c8d17193b 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -347,8 +347,6 @@ class ReplySplitTestCase(PluginTestCase): irc.reply('abc '*400) def largeprivmsg(self, irc, msg, args): irc.reply('abc '*400, notice=False) - - class LargeError(callbacks.Plugin): def largeerror(self, irc, msg, args): irc.error('abc '*400) @@ -369,6 +367,14 @@ class ReplySplitTestCase(PluginTestCase): self.assertEqual(m.args[0], self.nick) self.assertEqual(m.args[1], 'abc '*113 + '\x02(3 more messages)\x02') + def testLargeError(self): + self.irc.addCallback(self.LargeMessage(self.irc)) + self.feedMsg('@largeerror') + m = self.irc.takeMsg() + self.assertEqual(m.command, 'NOTICE') + self.assertEqual(m.args[0], self.nick) + self.assertEqual(m.args[1], 'Error: ' + 'abc '*111 + ' \x02(3 more messages)\x02') + class ChannelReplySplitTestCase(ChannelPluginTestCase): plugins = () @@ -377,6 +383,8 @@ class ChannelReplySplitTestCase(ChannelPluginTestCase): irc.reply('abc '*400, notice=True) def largeprivmsg(self, irc, msg, args): irc.reply('abc '*400) + def largeerror(self, irc, msg, args): + irc.error('abc '*400) class LargeError(callbacks.Plugin): def largeerror(self, irc, msg, args): @@ -398,6 +406,14 @@ class ChannelReplySplitTestCase(ChannelPluginTestCase): self.assertEqual(m.args[0], self.channel) self.assertEqual(m.args[1], self.nick + ': ' + 'abc '*111 + ' \x02(3 more messages)\x02') + def testLargeError(self): + self.irc.addCallback(self.LargeMessage(self.irc)) + self.feedMsg('@largeerror') + m = self.irc.takeMsg() + self.assertEqual(m.command, 'PRIVMSG') + self.assertEqual(m.args[0], self.channel) + self.assertEqual(m.args[1], self.nick + ': Error: ' + 'abc '*109 + ' \x02(3 more messages)\x02') + class AmbiguityTestCase(PluginTestCase): plugins = ('Misc',) # Something so it doesn't complain.