From 62f78a60a9b2694f3f0ade68771e54d636da4d6a Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 24 Jul 2016 11:03:23 -0700 Subject: [PATCH] commands: refactor showchan to use IrcChannel.getPrefixModes() --- plugins/commands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/commands.py b/plugins/commands.py index 705159c..1712b17 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -86,7 +86,6 @@ def showchan(irc, source, args): return nicks = [irc.users[u].nick for u in c.users] - pmodes = ('owner', 'admin', 'op', 'halfop', 'voice') f('Information on channel \x02%s\x02:' % channel) f('\x02Channel topic\x02: %s' % c.topic) @@ -99,9 +98,10 @@ def showchan(irc, source, args): # Iterate over the user list, sorted by nick. for user, nick in sorted(zip(c.users, nicks), key=lambda userpair: userpair[1].lower()): - prefixmodes = [irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '') - for pmode in pmodes if user in c.prefixmodes[pmode]] - nicklist.append(''.join(prefixmodes) + nick) + for pmode in c.getPrefixModes(user): + # Show prefix modes in order from highest to lowest. + nick = irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '') + nick + nicklist.append(nick) while nicklist[:20]: # 20 nicks per line to prevent message cutoff. f('\x02User list\x02: %s' % ' '.join(nicklist[:20]))