summaryrefslogtreecommitdiff
path: root/miniircd
diff options
context:
space:
mode:
authorFilipe Pina <fopina@gmail.com>2016-09-16 03:03:01 +0100
committerJoel Rosdahl <joel@rosdahl.net>2016-09-20 22:45:26 +0200
commitf301f19efdb6f3157e51d09a1cbfe8047059aac8 (patch)
tree1b1264a6f269405f53aea5b0feb3d137efafdc76 /miniircd
parent47f1fc09c64be6183c515ea27cda0c27073bc851 (diff)
downloadminiircd-f301f19efdb6f3157e51d09a1cbfe8047059aac8.tar.gz
miniircd-f301f19efdb6f3157e51d09a1cbfe8047059aac8.zip
split name listing message into multiple 353 messages maxed out at length 512
Diffstat (limited to 'miniircd')
-rwxr-xr-xminiircd15
1 files 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))