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.
This commit is contained in:
Valentin Lorentz 2021-03-05 21:19:02 +01:00
parent f98542e884
commit 11e79e44c5
2 changed files with 13 additions and 8 deletions

View File

@ -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()

View File

@ -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))