aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-03 14:10:25 +0100
committerGravatar jesopo2019-06-03 14:10:25 +0100
commit95f59779f7b474266ff9812f71b994c7157f327e (patch)
treec01e15c8f11039b0e448fe893f6912e5c03deac1 /modules
parentpass `is_channel` through CTCP events, fire generic "got a ctcp" event (diff)
signature
Also track msgids from CTCP in ircv3_msgid.py
Diffstat (limited to 'modules')
-rw-r--r--modules/ircv3_msgid.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/ircv3_msgid.py b/modules/ircv3_msgid.py
index 7edeed78..520198d6 100644
--- a/modules/ircv3_msgid.py
+++ b/modules/ircv3_msgid.py
@@ -3,11 +3,19 @@ from src import ModuleManager, utils
TAG = utils.irc.MessageTag("msgid", "draft/msgid")
class Module(ModuleManager.BaseModule):
+ def _on_channel(self, channel, tags):
+ msgid = TAG.get_value(tags)
+ if not msgid == None:
+ channel.set_setting("last-msgid", msgid)
+
@utils.hook("received.message.channel")
- #TODO: catch CTCPs
@utils.hook("received.notice.channel")
@utils.hook("received.tagmsg.channel")
def on_channel(self, event):
- msgid = TAG.get_value(event["tags"])
- if not msgid == None:
- event["channel"].set_setting("last-msgid", msgid)
+ self._on_channel(event["channel"], event["tags"])
+
+ @utils.hook("received.ctcp.request")
+ @utils.hook("received.ctcp.response")
+ def ctcp(self, event):
+ if event["is_channel"]:
+ self._on_channel(event["target"], event["tags"])