diff options
author | Filipe Pina <fopina@gmail.com> | 2016-09-16 03:03:01 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2016-09-20 22:45:26 +0200 |
commit | f301f19efdb6f3157e51d09a1cbfe8047059aac8 (patch) | |
tree | 1b1264a6f269405f53aea5b0feb3d137efafdc76 | |
parent | 47f1fc09c64be6183c515ea27cda0c27073bc851 (diff) | |
download | miniircd-f301f19efdb6f3157e51d09a1cbfe8047059aac8.tar.gz miniircd-f301f19efdb6f3157e51d09a1cbfe8047059aac8.zip |
split name listing message into multiple 353 messages maxed out at length 512
-rwxr-xr-x | miniircd | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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)) |