Standardise the "last" argument of a line; be that an :arbitrary or just the
last argument.
This commit is contained in:
parent
451b4e7207
commit
aca5d78cee
1 changed files with 10 additions and 11 deletions
|
@ -84,24 +84,24 @@ class LineHandler(object):
|
||||||
if hook.kwargs.get("default_event", False):
|
if hook.kwargs.get("default_event", False):
|
||||||
default_event = True
|
default_event = True
|
||||||
break
|
break
|
||||||
|
last = arbitrary or args[-1]
|
||||||
|
|
||||||
#server, prefix, command, args, arbitrary
|
#server, prefix, command, args, arbitrary
|
||||||
self.events.on("raw").on(command).call(server=server,
|
self.events.on("raw").on(command).call(server=server, last=last,
|
||||||
prefix=prefix, args=args, arbitrary=arbitrary, tags=tags)
|
prefix=prefix, args=args, arbitrary=arbitrary, tags=tags)
|
||||||
if default_event or not hooks:
|
if default_event or not hooks:
|
||||||
if command.isdigit():
|
if command.isdigit():
|
||||||
self.events.on("received.numeric").on(command
|
self.events.on("received.numeric").on(command).call(
|
||||||
).call(line=original_line, server=server, tags=tags,
|
line=original_line, server=server, tags=tags, last=last,
|
||||||
line_split=original_line.split(" "), number=command)
|
line_split=original_line.split(" "), number=command)
|
||||||
else:
|
else:
|
||||||
self.events.on("received").on(command).call(
|
self.events.on("received").on(command).call(
|
||||||
line=original_line, line_split=original_line.split(" "),
|
line=original_line, line_split=original_line.split(" "),
|
||||||
command=command, server=server, tags=tags)
|
command=command, server=server, tags=tags, last=last)
|
||||||
|
|
||||||
# ping from the server
|
# ping from the server
|
||||||
def ping(self, event):
|
def ping(self, event):
|
||||||
nonce = event["arbitrary"]
|
event["server"].send_pong(event["last"])
|
||||||
event["server"].send_pong(nonce)
|
|
||||||
|
|
||||||
# first numeric line the server sends
|
# first numeric line the server sends
|
||||||
def handle_001(self, event):
|
def handle_001(self, event):
|
||||||
|
@ -219,8 +219,7 @@ class LineHandler(object):
|
||||||
account = event["args"][1]
|
account = event["args"][1]
|
||||||
realname = event["arbitrary"]
|
realname = event["arbitrary"]
|
||||||
else:
|
else:
|
||||||
channel = event["server"].get_channel(
|
channel = event["server"].get_channel(event["last"])
|
||||||
event["arbitrary"] or event["args"][0])
|
|
||||||
|
|
||||||
if not event["server"].is_own_nickname(nickname):
|
if not event["server"].is_own_nickname(nickname):
|
||||||
user = event["server"].get_user(nickname)
|
user = event["server"].get_user(nickname)
|
||||||
|
@ -387,7 +386,7 @@ class LineHandler(object):
|
||||||
mode_args=_args, channel=channel, server=event["server"],
|
mode_args=_args, channel=channel, server=event["server"],
|
||||||
user=user)
|
user=user)
|
||||||
elif event["server"].is_own_nickname(target):
|
elif event["server"].is_own_nickname(target):
|
||||||
modes = RE_MODES.findall(event["arbitrary"] or args[1])
|
modes = RE_MODES.findall(event["last"])
|
||||||
for chunk in modes:
|
for chunk in modes:
|
||||||
remove = chunk[0] == "-"
|
remove = chunk[0] == "-"
|
||||||
for mode in chunk[1:]:
|
for mode in chunk[1:]:
|
||||||
|
@ -399,7 +398,7 @@ class LineHandler(object):
|
||||||
def invite(self, event):
|
def invite(self, event):
|
||||||
nickname, username, hostname = Utils.seperate_hostmask(
|
nickname, username, hostname = Utils.seperate_hostmask(
|
||||||
event["prefix"])
|
event["prefix"])
|
||||||
target_channel = event["arbitrary"] or event["args"][1]
|
target_channel = event["last"]
|
||||||
user = event["server"].get_user(nickname)
|
user = event["server"].get_user(nickname)
|
||||||
target_user = event["server"].get_user(event["args"][0])
|
target_user = event["server"].get_user(event["args"][0])
|
||||||
self.events.on("received.invite").call(user=user,
|
self.events.on("received.invite").call(user=user,
|
||||||
|
@ -532,7 +531,7 @@ class LineHandler(object):
|
||||||
hostname = event["args"][3]
|
hostname = event["args"][3]
|
||||||
nickname = event["args"][4]
|
nickname = event["args"][4]
|
||||||
account = event["args"][5]
|
account = event["args"][5]
|
||||||
realname = event["arbitrary"]
|
realname = event["last"]
|
||||||
|
|
||||||
user = event["server"].get_user(nickname)
|
user = event["server"].get_user(nickname)
|
||||||
user.username = username
|
user.username = username
|
||||||
|
|
Loading…
Reference in a new issue