From 2cd410ace8487422d6ed3ff9623cbbbfa37b75d9 Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Fri, 13 Jan 2017 12:05:16 -0500 Subject: [PATCH] Fix lowercasing a hostname to not use IRC lowercasing --- src/context.py | 4 ++-- src/users.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/context.py b/src/context.py index 15ca3d3..f11c09e 100644 --- a/src/context.py +++ b/src/context.py @@ -71,10 +71,10 @@ def _send(data, first, sep, client, send_type, name): extra, line = line[:length], line[length:] client.send("{0} {1} :{2}{3}".format(send_type, name, first, extra)) -def lower(nick): +def lower(nick, *, host=False): if nick is None: return None - if isinstance(nick, IRCContext): + if isinstance(nick, IRCContext) or host: return nick.lower() mapping = { diff --git a/src/users.py b/src/users.py index dedd1ca..d6bb71f 100644 --- a/src/users.py +++ b/src/users.py @@ -279,7 +279,7 @@ class User(IRCContext): return self._compare(other, __class__, "nick", "ident", "host", "realname", "account") def lower(self): - temp = type(self)(self.client, lower(self.nick), lower(self.ident), lower(self.host), lower(self.realname), lower(self.account)) + temp = type(self)(self.client, lower(self.nick), lower(self.ident), lower(self.host, host=True), lower(self.realname), lower(self.account)) if temp is not self: # If everything is already lowercase, we'll get back the same instance temp.channels = self.channels temp.ref = self.ref or self @@ -573,7 +573,7 @@ class BotUser(User): # TODO: change all the 'if x is Bot' for 'if isinstance(x, temp = type(self)(self.client, lower(self.nick)) if temp is not self: temp.ident = lower(self.ident) - temp.host = lower(self.host) + temp.host = lower(self.host, host=True) temp.realname = lower(self.realname) temp.account = lower(self.account) temp.modes = self.modes