mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
clientbot: only split /names replies by spaces
This fixes issues with colored hostnames because \x1f is treated as a whitespace char by str.split(). Closes #641.
This commit is contained in:
parent
5ca57cb3c1
commit
9056799633
@ -740,14 +740,19 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
prefix_to_mode = {v:k for k, v in self.prefixmodes.items()}
|
prefix_to_mode = {v:k for k, v in self.prefixmodes.items()}
|
||||||
prefixes = ''.join(self.prefixmodes.values())
|
prefixes = ''.join(self.prefixmodes.values())
|
||||||
|
|
||||||
for name in args[-1].split():
|
# 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(' '):
|
||||||
nick = name.lstrip(prefixes)
|
nick = name.lstrip(prefixes)
|
||||||
|
|
||||||
# Handle userhost-in-names where available.
|
# Handle userhost-in-names where available.
|
||||||
if 'userhost-in-names' in self.ircv3_caps:
|
|
||||||
nick, ident, host = utils.split_hostmask(nick)
|
|
||||||
else:
|
|
||||||
ident = host = None
|
ident = host = None
|
||||||
|
if 'userhost-in-names' in self.ircv3_caps:
|
||||||
|
try:
|
||||||
|
nick, ident, host = utils.split_hostmask(nick)
|
||||||
|
except ValueError:
|
||||||
|
log.exception('(%s) Failed to split hostmask %r from /names reply on %s', self.name, nick, channel)
|
||||||
|
# If error, leave nick unsplit
|
||||||
|
|
||||||
# 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user