From f301f19efdb6f3157e51d09a1cbfe8047059aac8 Mon Sep 17 00:00:00 2001 From: Filipe Pina Date: Fri, 16 Sep 2016 03:03:01 +0100 Subject: split name listing message into multiple 353 messages maxed out at length 512 --- miniircd | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/miniircd b/miniircd index bf4d443..9a7b059 100755 --- a/miniircd +++ b/miniircd @@ -269,11 +269,16 @@ class Client(object): else: self.reply("331 %s %s :No topic is set" % (self.nickname, channel.name)) - self.reply("353 %s = %s :%s" - % (self.nickname, - channelname, - " ".join(sorted(x.nickname - for x in channel.members)))) + names_prefix = "353 %s = %s :" % (self.nickname, channelname) + names = names_prefix + for name in sorted(x.nickname for x in channel.members): + # 510 + space + CRLF = 512 as per RFC + if len(names) + len(name) > 509: + self.reply(names) + names = names_prefix + name + else: + names += ' ' + name + self.reply(names) self.reply("366 %s %s :End of NAMES list" % (self.nickname, channelname)) -- cgit v1.2.3