diff options
author | Filipe Pina <fopina@gmail.com> | 2016-09-19 17:22:00 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2016-09-20 22:45:26 +0200 |
commit | f2ada2ad57cef7eec0da84a04cd78a126ff47bc3 (patch) | |
tree | 02cc1545395deccdfbf6db355e0b69baf03ff7fb /miniircd | |
parent | 505cdd6ba74eb609d80d1ac00332bec9f5495f91 (diff) | |
download | miniircd-f2ada2ad57cef7eec0da84a04cd78a126ff47bc3.tar.gz miniircd-f2ada2ad57cef7eec0da84a04cd78a126ff47bc3.zip |
PEP8 + test.py
Diffstat (limited to 'miniircd')
-rwxr-xr-x | miniircd | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -270,17 +270,21 @@ class Client(object): self.reply("331 %s %s :No topic is set" % (self.nickname, channel.name)) names_prefix = "353 %s = %s :" % (self.nickname, channelname) - names = names_prefix - # max length: reply prefix ":server_name(space)" plus CRLF in the end + names = '' + # max length: reply prefix ":server_name(space)" + # plus CRLF in the end names_max_len = 512 - (len(self.server.name) + 2 + 2) for name in sorted(x.nickname for x in channel.members): + if not names: + names = names_prefix + name # using >= to include the space between "names" and "name" - if len(names) + len(name) >= names_max_len: + elif len(names) + len(name) >= names_max_len: self.reply(names) names = names_prefix + name else: names += ' ' + name - self.reply(names) + if names: + self.reply(names) self.reply("366 %s %s :End of NAMES list" % (self.nickname, channelname)) |