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

unreal: ignore userpairs with only a prefix and no user

How is this even possible?!

Reported by @koaxirc.

(cherry picked from commit 9fac7cb1f3)
This commit is contained in:
James Lu 2017-02-05 22:23:20 -08:00
parent f7768a00a0
commit f70e771000

View File

@ -617,12 +617,18 @@ class UnrealProtocol(TS6BaseProtocol):
else: else:
r = re.search(r'([^\w]*)(.*)', userpair) r = re.search(r'([^\w]*)(.*)', userpair)
user = r.group(2) user = r.group(2)
if not user:
# Userpair with no user? Ignore. XXX: find out how this is even possible...
# <- :002 SJOIN 1486361658 #idlerpg :@
continue
user = self._getUid(user) # Normalize nicks to UIDs for Unreal 3.2 links user = self._getUid(user) # Normalize nicks to UIDs for Unreal 3.2 links
# Unreal uses slightly different prefixes in SJOIN. +q is * instead of ~, # Unreal uses slightly different prefixes in SJOIN. +q is * instead of ~,
# and +a is ~ instead of &. # and +a is ~ instead of &.
modeprefix = (r.group(1) or '').replace("~", "&").replace("*", "~") modeprefix = (r.group(1) or '').replace("~", "&").replace("*", "~")
finalprefix = '' finalprefix = ''
assert user, 'Failed to get the UID from %r; our regex needs updating?' % userpair
log.debug('(%s) handle_sjoin: got modeprefix %r for user %r', self.irc.name, modeprefix, user) log.debug('(%s) handle_sjoin: got modeprefix %r for user %r', self.irc.name, modeprefix, user)
for m in modeprefix: for m in modeprefix:
# Iterate over the mapping of prefix chars to prefixes, and # Iterate over the mapping of prefix chars to prefixes, and