'seperate_hostmask()' -> 'parse_hostmask()'
This commit is contained in:
parent
4ccfd821c8
commit
334d580c57
4 changed files with 6 additions and 6 deletions
|
@ -131,7 +131,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
raise utils.EventError("Please provide <hostname>:[+]<port>")
|
raise utils.EventError("Please provide <hostname>:[+]<port>")
|
||||||
port = int(port)
|
port = int(port)
|
||||||
|
|
||||||
hostmask = utils.irc.seperate_hostmask(event["args_split"][2])
|
hostmask = utils.irc.parse_hostmask(event["args_split"][2])
|
||||||
nickname = hostmask.nickname
|
nickname = hostmask.nickname
|
||||||
username = hostmask.username or nickname
|
username = hostmask.username or nickname
|
||||||
realname = nickname
|
realname = nickname
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("raw.send.privmsg", priority=EventManager.PRIORITY_MONITOR)
|
@utils.hook("raw.send.privmsg", priority=EventManager.PRIORITY_MONITOR)
|
||||||
@utils.hook("raw.send.notice", priority=EventManager.PRIORITY_MONITOR)
|
@utils.hook("raw.send.notice", priority=EventManager.PRIORITY_MONITOR)
|
||||||
def send_message(self, event):
|
def send_message(self, event):
|
||||||
our_hostmask = utils.irc.seperate_hostmask(event["server"].hostmask())
|
our_hostmask = utils.irc.parse_hostmask(event["server"].hostmask())
|
||||||
|
|
||||||
echo = IRCLine.ParsedLine(event["line"].command, event["line"].args,
|
echo = IRCLine.ParsedLine(event["line"].command, event["line"].args,
|
||||||
source=our_hostmask, tags=event["line"].tags)
|
source=our_hostmask, tags=event["line"].tags)
|
||||||
|
|
|
@ -18,7 +18,7 @@ def topic(events, event):
|
||||||
def handle_333(events, event):
|
def handle_333(events, event):
|
||||||
channel = event["server"].channels.get(event["line"].args[1])
|
channel = event["server"].channels.get(event["line"].args[1])
|
||||||
|
|
||||||
topic_setter = utils.irc.seperate_hostmask(event["line"].args[2])
|
topic_setter = utils.irc.parse_hostmask(event["line"].args[2])
|
||||||
topic_time = int(event["line"].args[3])
|
topic_time = int(event["line"].args[3])
|
||||||
|
|
||||||
channel.set_topic_setter(topic_setter)
|
channel.set_topic_setter(topic_setter)
|
||||||
|
@ -42,7 +42,7 @@ def handle_353(event):
|
||||||
nickname = nickname[1:]
|
nickname = nickname[1:]
|
||||||
|
|
||||||
if event["server"].has_capability_str("userhost-in-names"):
|
if event["server"].has_capability_str("userhost-in-names"):
|
||||||
hostmask = utils.irc.seperate_hostmask(nickname)
|
hostmask = utils.irc.parse_hostmask(nickname)
|
||||||
nickname = hostmask.nickname
|
nickname = hostmask.nickname
|
||||||
user = event["server"].get_user(hostmask.nickname)
|
user = event["server"].get_user(hostmask.nickname)
|
||||||
user.username = hostmask.username
|
user.username = hostmask.username
|
||||||
|
|
|
@ -30,7 +30,7 @@ def lower(case_mapping: str, s: str) -> str:
|
||||||
def equals(case_mapping: str, s1: str, s2: str) -> bool:
|
def equals(case_mapping: str, s1: str, s2: str) -> bool:
|
||||||
return lower(case_mapping, s1) == lower(case_mapping, s2)
|
return lower(case_mapping, s1) == lower(case_mapping, s2)
|
||||||
|
|
||||||
def seperate_hostmask(hostmask: str) -> IRCLine.Hostmask:
|
def parse_hostmask(hostmask: str) -> IRCLine.Hostmask:
|
||||||
nickname, _, username = hostmask.partition("!")
|
nickname, _, username = hostmask.partition("!")
|
||||||
username, _, hostname = username.partition("@")
|
username, _, hostname = username.partition("@")
|
||||||
return IRCLine.Hostmask(nickname, username, hostname, hostmask)
|
return IRCLine.Hostmask(nickname, username, hostname, hostmask)
|
||||||
|
@ -66,7 +66,7 @@ def parse_line(line: str) -> IRCLine.ParsedLine:
|
||||||
|
|
||||||
if line[0] == ":":
|
if line[0] == ":":
|
||||||
source_str, line = line[1:].split(" ", 1)
|
source_str, line = line[1:].split(" ", 1)
|
||||||
source = seperate_hostmask(source_str)
|
source = parse_hostmask(source_str)
|
||||||
|
|
||||||
command, sep, line = line.partition(" ")
|
command, sep, line = line.partition(" ")
|
||||||
args = [] # type: typing.List[str]
|
args = [] # type: typing.List[str]
|
||||||
|
|
Loading…
Reference in a new issue