mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
Irc: make sorting in joinModes() an option, and explicitly enable it in WHOIS output
This prevents mode lists from being sorted when they really shouldn't be, such as when relaying mode changes ("+qo nick nick" became +oq nick nick").
(cherry picked from commit 4b27ebbee4
)
This commit is contained in:
parent
eb2bc68c07
commit
c9ce4d1507
@ -751,7 +751,7 @@ class Irc():
|
|||||||
return set(newmodes)
|
return set(newmodes)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def joinModes(modes):
|
def joinModes(modes, sort=False):
|
||||||
"""Takes a list of (mode, arg) tuples in parseModes() format, and
|
"""Takes a list of (mode, arg) tuples in parseModes() format, and
|
||||||
joins them into a string.
|
joins them into a string.
|
||||||
|
|
||||||
@ -761,6 +761,7 @@ class Irc():
|
|||||||
args = []
|
args = []
|
||||||
|
|
||||||
# Sort modes alphabetically like a conventional IRCd.
|
# Sort modes alphabetically like a conventional IRCd.
|
||||||
|
if sort:
|
||||||
modes = sorted(modes)
|
modes = sorted(modes)
|
||||||
|
|
||||||
for modepair in modes:
|
for modepair in modes:
|
||||||
|
@ -87,7 +87,7 @@ def handle_whois(irc, source, command, args):
|
|||||||
# Only show this to opers!
|
# Only show this to opers!
|
||||||
if sourceisOper:
|
if sourceisOper:
|
||||||
f(378, source, "%s :is connecting from %s@%s %s" % (nick, user.ident, user.realhost, user.ip))
|
f(378, source, "%s :is connecting from %s@%s %s" % (nick, user.ident, user.realhost, user.ip))
|
||||||
f(379, source, '%s :is using modes %s' % (nick, irc.joinModes(user.modes)))
|
f(379, source, '%s :is using modes %s' % (nick, irc.joinModes(user.modes, sort=True)))
|
||||||
|
|
||||||
# 301: used to show away information if present
|
# 301: used to show away information if present
|
||||||
away_text = user.away
|
away_text = user.away
|
||||||
|
Loading…
Reference in New Issue
Block a user