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

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.
This commit is contained in:
James Lu 2016-08-09 18:39:13 -07:00
parent 1660705658
commit bdadb27466

View File

@ -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