From 81bf6480df34224a48894a586a531361a8697e01 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 29 Apr 2019 12:04:11 -0700 Subject: [PATCH] clientbot: avoid adding empty nicks to the state It looks like names replies may end with an extra space, which should not be considered as part of the nick list.. (cherry picked from commit f90b0c857745090ff330fe70421966e11d65a9d6) --- protocols/clientbot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 37f345d..04153d8 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -683,7 +683,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): # N.B. only split on spaces because of color in hosts nonsense... # str.split() by default treats \x1f as whitespace - for name in args[-1].split(' '): + for name in args[-1].strip().split(' '): nick = name.lstrip(prefixes) # Handle userhost-in-names where available. @@ -695,6 +695,9 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): log.exception('(%s) Failed to split hostmask %r from /names reply on %s; args=%s', self.name, nick, channel, args) # If error, leave nick unsplit + if not nick: + continue + # Get the PUID for the given nick. If one doesn't exist, spawn # a new virtual user. idsource = self._get_UID(nick, ident=ident, host=host)