diff --git a/protocols/inspircd.py b/protocols/inspircd.py index a48cbc9..97bf542 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -467,6 +467,13 @@ class InspIRCdProtocol(TS6BaseProtocol): namelist = [] for user in userlist: modeprefix, user = user.split(',', 1) + + # Don't crash when we get an invalid UID. + if user not in self.irc.users: + log.debug('(%s) handle_fjoin: tried to introduce user %s not in our user list, ignoring...', + self.irc.name, user) + continue + namelist.append(user) self.irc.users[user].channels.add(channel) if their_ts <= our_ts: diff --git a/protocols/ts6.py b/protocols/ts6.py index 2fadabf..f0d4ec6 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -435,6 +435,13 @@ class TS6Protocol(TS6BaseProtocol): 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) + + # Don't crash when we get an invalid UID. + if user not in self.irc.users: + log.debug('(%s) handle_sjoin: tried to introduce user %s not in our user list, ignoring...', + self.irc.name, user) + continue + for m in modeprefix: # Iterate over the mapping of prefix chars to prefixes, and # find the characters that match.