From bdadb27466e40b15b3deed1d075df5eb503de5f8 Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 9 Aug 2016 18:39:13 -0700 Subject: [PATCH] relay: reverse getPrefixModes() output so the right mode order is passed to sjoin() This prevents users from bursted as "+@~UID" instead of "~@+UID", for example. --- plugins/relay.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 1be7a45..06df1c8 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -234,8 +234,11 @@ def getPrefixModes(irc, remoteirc, channel, user, mlist=None): modes = '' if user in irc.channels[channel].users: - # Iterate over the the prefix modes for relay supported by IRCd - for pmode in irc.channels[channel].getPrefixModes(user, prefixmodes=mlist): + # Iterate over the the prefix modes for relay supported by the remote IRCd. + # Note: reverse the order so prefix modes are bursted in their traditional order + # (e.g. owner before op before halfop). TODO: SJOIN modes should probably be + # consistently sorted IRCd-side. + for pmode in reversed(irc.channels[channel].getPrefixModes(user, prefixmodes=mlist)): if pmode in remoteirc.cmodes: modes += remoteirc.cmodes[pmode] return modes