diff --git a/src/callbacks.py b/src/callbacks.py index a9458f1bb..759443df5 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -999,10 +999,17 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): # (which is used like a stack) chunks.reverse() + instant = conf.get(conf.supybot.reply.mores.instant, + channel=target, network=self.irc.network) + msgs = [] for (i, chunk) in enumerate(chunks): if i == 0: pass # last message, no suffix to add + elif len(chunks) - i < instant: + # one of the first messages, and the next one will + # also be sent immediately, so no suffix + pass else: if i == 1: more = _('more message') @@ -1012,8 +1019,6 @@ class NestedCommandsIrcProxy(ReplyIrcProxy): chunk = '%s %s' % (chunk, n) msgs.append(_makeReply(self, msg, chunk, **replyArgs)) - instant = conf.get(conf.supybot.reply.mores.instant, - channel=target, network=self.irc.network) while instant > 1 and msgs: instant -= 1 response = msgs.pop() diff --git a/test/test_callbacks.py b/test/test_callbacks.py index 078d8b927..3cf7a20a7 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -540,28 +540,28 @@ class PrivmsgTestCase(ChannelPluginTestCase): self.assertResponse( "eval 'foo '*300", "'" + "foo " * 110 + " \x02(2 more messages)\x02") - self.assertNoResponse(' ') + self.assertNoResponse(" ", timeout=0.1) with conf.supybot.reply.mores.instant.context(2): self.assertResponse( "eval 'foo '*300", - "'" + "foo " * 110 + " \x02(2 more messages)\x02") + "'" + "foo " * 110) self.assertResponse( " ", "foo " * 111 + "\x02(1 more message)\x02") - self.assertNoResponse(" ") + self.assertNoResponse(" ", timeout=0.1) with conf.supybot.reply.mores.instant.context(3): self.assertResponse( "eval 'foo '*300", - "'" + "foo " * 110 + " \x02(2 more messages)\x02") + "'" + "foo " * 110) self.assertResponse( " ", - "foo " * 111 + "\x02(1 more message)\x02") + "foo " * 110 + "foo") self.assertResponse( " ", " " + "foo " * 79 + "'") - self.assertNoResponse(" ") + self.assertNoResponse(" ", timeout=0.1) def testClientTagReply(self): self.irc.addCallback(self.First(self.irc))