From 11e79e44c599b0efd03316ee406f9e5fa0fef477 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 5 Mar 2021 21:19:02 +0100 Subject: [PATCH] Remove the '(XX more messages)' when the next message is sent immediately after It's pointless and looks stupid. It will look even more stupid when we enable multiline, because the suffixes will be in the middle of the concatenated message. --- src/callbacks.py | 9 +++++++-- test/test_callbacks.py | 12 ++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) 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))