aboutsummaryrefslogtreecommitdiff
path: root/modules/line_handler.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-02-12 16:49:57 +0000
committerGravatar jesopo2019-02-12 16:49:57 +0000
commit938495fc3a3a7ac8c48363b997935358dcdb61c1 (patch)
treece093fa5cac72bc3c6e7a155e5c30df548710b67 /modules/line_handler.py
parentAlso strip \x01 off the start of CTCP commands, if it's there (utils.irc) (diff)
signature
Refactor how CTCPs are sent through events
Diffstat (limited to 'modules/line_handler.py')
-rw-r--r--modules/line_handler.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/modules/line_handler.py b/modules/line_handler.py
index f7d0ae50..4706e367 100644
--- a/modules/line_handler.py
+++ b/modules/line_handler.py
@@ -444,7 +444,6 @@ class Module(ModuleManager.BaseModule):
user = event["server"].get_user(event["prefix"].nickname)
message = event["args"][1]
- message_split = message.split(" ")
target = event["args"][0]
# strip prefix_symbols from the start of target, for when people use
@@ -460,31 +459,27 @@ class Module(ModuleManager.BaseModule):
channel = event["server"].channels.get(target)
action = False
+ event_type = "message"
ctcp_message = utils.irc.parse_ctcp(message)
if ctcp_message:
+ message = ctcp_message.message
+ event_type = "ctcp.%s" % ctcp_message.command
if ctcp_message.command == "ACTION":
action = True
message = ctcp_message.message
- else:
- if channel:
- self._event(event, "ctcp.channel", channel=channel,
- ctcp=ctcp_message)
- else:
- self._event(event, "ctcp.private", user=user,
- ctcp=ctcp_message)
if user and "account" in event["tags"]:
user.identified_account = event["tags"]["account"]
user.identified_account_id = event["server"].get_user(
event["tags"]["account"]).get_id()
- kwargs = {"message": message, "message_split": message_split,
+ kwargs = {"message": message, "message_split": message.split(),
"server": event["server"], "tags": event["tags"],
"action": action}
direction = "send" if from_self else "received"
context = "channel" if channel else "private"
- hook = self.events.on(direction).on("message").on(context)
+ hook = self.events.on(direction).on(event_type).on(context)
if channel:
hook.call(user=user, channel=channel, statusmsg=statusmsg, **kwargs)