aboutsummaryrefslogtreecommitdiff
path: root/Utils.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-10 09:31:24 +0100
committerGravatar jesopo2018-09-10 09:31:24 +0100
commit7530bb7cbdf91397d24ec827cae3695138400dad (patch)
treea2ea77b4968d279ca453d0ffd37c9889dd1f32fd /Utils.py
parentHandle CHGHOST referencing the bot instead of another user (diff)
Pass around an IRCPrefix object instead of "nickname!username@hostname", fix a
bug in TAGMSG handling that was trying to get a user object from a channel, fix a bug in ACCOUNT handling that was literally using "nickname" as a user's nickname, instead of the parsed nickname.
Diffstat (limited to 'Utils.py')
-rw-r--r--Utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Utils.py b/Utils.py
index 8e5baa63..0aa407d4 100644
--- a/Utils.py
+++ b/Utils.py
@@ -13,6 +13,12 @@ def remove_colon(s):
def arbitrary(s, n):
return remove_colon(" ".join(s[n:]))
+class IRCHostmask(object):
+ def __init__(self, nickname, username, hostname, hostmask):
+ self.nickname = nickname
+ self.username = username
+ self.hostname = hostname
+ self.hostmask = hostmask
def seperate_hostmask(hostmask):
hostmask = remove_colon(hostmask)
first_delim = hostmask.find("!")
@@ -21,7 +27,7 @@ def seperate_hostmask(hostmask):
if first_delim > -1 and second_delim > first_delim:
nickname, username = hostmask.split("!", 1)
username, hostname = username.split("@", 1)
- return nickname, username, hostname
+ return IRCHostmask(nickname, username, hostname, hostmask)
def get_url(url, **kwargs):
if not urllib.parse.urlparse(url).scheme: