3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +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):
continue
# Show prefix modes like a regular IRCd does.
for prefixmode in c.getPrefixModes(target):
modechar = irc.cmodes[prefixmode]
# Show the highest prefix mode like a regular IRCd does, if there are any.
prefixes = c.getPrefixModes(target)
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
public_chans.append(chan)