Simplify Utils.seperate_hostmask
This commit is contained in:
parent
22740e2faa
commit
74180cb103
1 changed files with 2 additions and 8 deletions
10
src/Utils.py
10
src/Utils.py
|
@ -53,14 +53,8 @@ class IRCHostmask(object):
|
|||
|
||||
def seperate_hostmask(hostmask):
|
||||
hostmask = remove_colon(hostmask)
|
||||
first_delim = hostmask.find("!")
|
||||
second_delim = hostmask.find("@")
|
||||
nickname, username, hostname = hostmask, None, None
|
||||
if first_delim > -1 and second_delim > first_delim:
|
||||
nickname, username = hostmask.split("!", 1)
|
||||
username, hostname = username.split("@", 1)
|
||||
elif second_delim > -1:
|
||||
nickname, hostname = hostmask.split("@", 1)
|
||||
nickname, _, username = hostmask.partition("!")
|
||||
username, _, hostname = username.partition("@")
|
||||
return IRCHostmask(nickname, username, hostname, hostmask)
|
||||
|
||||
def get_url(url, **kwargs):
|
||||
|
|
Loading…
Reference in a new issue