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

relay: oops, multiple STATUSMSG prefixes should pick the lowest, not highest (#570)

This behaviour really isn't consistent across IRCds though...
- Unreal, Hybrid, and charybdis mangle messages at the server side to use the lowest prefix
- InspIRCd throws a "No such nick/channel" error
- Nefarious silently drops messages with multiple prefixes?
This commit is contained in:
James Lu 2018-02-18 22:24:16 -08:00
parent 37be73d39c
commit 4a01948647

View File

@ -1329,14 +1329,14 @@ def handle_part(irc, numeric, command, args):
utils.add_hook(handle_part, 'PART') utils.add_hook(handle_part, 'PART')
def _get_highest_prefix(prefixes): def _get_lowest_prefix(prefixes):
if not prefixes: if not prefixes:
return '' return ''
for prefix in 'qyaohv': for prefix in 'vhoayq':
if prefix in prefixes: if prefix in prefixes:
return prefix return prefix
else: else:
log.warning('relay._get_highest_prefix: unknown prefixes string %r', prefixes) log.warning('relay._get_lowest_prefix: unknown prefixes string %r', prefixes)
return '' return ''
def handle_messages(irc, numeric, command, args): def handle_messages(irc, numeric, command, args):
@ -1397,10 +1397,10 @@ def handle_messages(irc, numeric, command, args):
return return
# This bit of filtering exists because some IRCds let you do /msg ~@#channel # This bit of filtering exists because some IRCds let you do /msg ~@#channel
# and such, despite its redundancy. (This is equivalent to ~#channel AFAIK) # and such, despite its redundancy. (This is equivalent to @#channel AFAIK)
highest_msgprefix = _get_highest_prefix(msgprefixes) lowest_msgprefix = _get_lowest_prefix(msgprefixes)
highest_msgprefix = remoteirc.prefixmodes.get(highest_msgprefix, '') lowest_msgprefix = remoteirc.prefixmodes.get(lowest_msgprefix, '')
real_target = highest_msgprefix + real_target real_target = lowest_msgprefix + real_target
user = get_remote_user(irc, remoteirc, numeric, spawn_if_missing=False) user = get_remote_user(irc, remoteirc, numeric, spawn_if_missing=False)