3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

handlers: only show the highest prefix mode for channels in WHOIS output

Closes #270.
This commit is contained in:
James Lu 2016-07-11 15:42:58 -07:00
parent 2a08ae98b0
commit 1cf560c465

View File

@ -41,9 +41,15 @@ def handle_whois(irc, source, command, args):
and not (sourceisOper or source in c.users): and not (sourceisOper or source in c.users):
continue continue
# Show prefix modes like a regular IRCd does. # Show the highest prefix mode like a regular IRCd does, if there are any.
for prefixmode in c.getPrefixModes(target): prefixes = c.getPrefixModes(target)
modechar = irc.cmodes[prefixmode] if prefixes:
highest = prefixes[-1]
# Fetch the prefix mode letter from the named mode.
modechar = irc.cmodes[highest]
# Fetch and prepend the prefix character (@, +, etc.), given the mode letter.
chan = irc.prefixmodes[modechar] + chan chan = irc.prefixmodes[modechar] + chan
public_chans.append(chan) public_chans.append(chan)