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

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 f90b0c8577)
This commit is contained in:
James Lu 2019-04-29 12:04:11 -07:00
parent 7e088dfacb
commit 81bf6480df

View File

@ -683,7 +683,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
# N.B. only split on spaces because of color in hosts nonsense... # N.B. only split on spaces because of color in hosts nonsense...
# str.split() by default treats \x1f as whitespace # 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) nick = name.lstrip(prefixes)
# Handle userhost-in-names where available. # 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) 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 error, leave nick unsplit
if not nick:
continue
# Get the PUID for the given nick. If one doesn't exist, spawn # Get the PUID for the given nick. If one doesn't exist, spawn
# a new virtual user. # a new virtual user.
idsource = self._get_UID(nick, ident=ident, host=host) idsource = self._get_UID(nick, ident=ident, host=host)