mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-25 12:31:04 -05:00
callbacks: Split long errors.
This commit is contained in:
parent
e531bc027e
commit
1c4a3c25f5
@ -737,9 +737,9 @@ class ReplyIrcProxy(RichReplyMethods):
|
|||||||
if msg is None:
|
if msg is None:
|
||||||
msg = self.msg
|
msg = self.msg
|
||||||
if s:
|
if s:
|
||||||
m = _makeErrorReply(self, msg, s, **kwargs)
|
msg.tag('isError')
|
||||||
self.irc.queueMsg(m)
|
kwargs['error'] = True
|
||||||
return m
|
return self._replyFinal(msg, s, **kwargs)
|
||||||
|
|
||||||
def reply(self, s, msg=None, **kwargs):
|
def reply(self, s, msg=None, **kwargs):
|
||||||
if msg is None:
|
if msg is None:
|
||||||
@ -1131,9 +1131,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
if not isinstance(self.irc, irclib.Irc):
|
if not isinstance(self.irc, irclib.Irc):
|
||||||
return self.irc.error(s, **kwargs)
|
return self.irc.error(s, **kwargs)
|
||||||
elif s:
|
elif s:
|
||||||
m = _makeErrorReply(self, self.msg, s, **kwargs)
|
return super(NestedCommandsIrcProxy, self).error(s, self.msg, **kwargs)
|
||||||
self.irc.queueMsg(m)
|
|
||||||
return m
|
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return getattr(self.irc, attr)
|
return getattr(self.irc, attr)
|
||||||
|
@ -347,8 +347,6 @@ class ReplySplitTestCase(PluginTestCase):
|
|||||||
irc.reply('abc '*400)
|
irc.reply('abc '*400)
|
||||||
def largeprivmsg(self, irc, msg, args):
|
def largeprivmsg(self, irc, msg, args):
|
||||||
irc.reply('abc '*400, notice=False)
|
irc.reply('abc '*400, notice=False)
|
||||||
|
|
||||||
class LargeError(callbacks.Plugin):
|
|
||||||
def largeerror(self, irc, msg, args):
|
def largeerror(self, irc, msg, args):
|
||||||
irc.error('abc '*400)
|
irc.error('abc '*400)
|
||||||
|
|
||||||
@ -369,6 +367,14 @@ class ReplySplitTestCase(PluginTestCase):
|
|||||||
self.assertEqual(m.args[0], self.nick)
|
self.assertEqual(m.args[0], self.nick)
|
||||||
self.assertEqual(m.args[1], 'abc '*113 + '\x02(3 more messages)\x02')
|
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):
|
class ChannelReplySplitTestCase(ChannelPluginTestCase):
|
||||||
plugins = ()
|
plugins = ()
|
||||||
@ -377,6 +383,8 @@ class ChannelReplySplitTestCase(ChannelPluginTestCase):
|
|||||||
irc.reply('abc '*400, notice=True)
|
irc.reply('abc '*400, notice=True)
|
||||||
def largeprivmsg(self, irc, msg, args):
|
def largeprivmsg(self, irc, msg, args):
|
||||||
irc.reply('abc '*400)
|
irc.reply('abc '*400)
|
||||||
|
def largeerror(self, irc, msg, args):
|
||||||
|
irc.error('abc '*400)
|
||||||
|
|
||||||
class LargeError(callbacks.Plugin):
|
class LargeError(callbacks.Plugin):
|
||||||
def largeerror(self, irc, msg, args):
|
def largeerror(self, irc, msg, args):
|
||||||
@ -398,6 +406,14 @@ class ChannelReplySplitTestCase(ChannelPluginTestCase):
|
|||||||
self.assertEqual(m.args[0], self.channel)
|
self.assertEqual(m.args[0], self.channel)
|
||||||
self.assertEqual(m.args[1], self.nick + ': ' + 'abc '*111 + ' \x02(3 more messages)\x02')
|
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):
|
class AmbiguityTestCase(PluginTestCase):
|
||||||
plugins = ('Misc',) # Something so it doesn't complain.
|
plugins = ('Misc',) # Something so it doesn't complain.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user