diff options
| author | 2019-12-10 05:27:35 +0000 | |
|---|---|---|
| committer | 2019-12-10 05:27:35 +0000 | |
| commit | 638eee0d685c06d258cb55287204ca97bca7c344 (patch) | |
| tree | 33442439317ae2846f1efb7674b7a3758c8990a1 /src/core_modules/ircv3_msgid.py | |
| parent | move sys.exit() codes to an enum in utils.consts (diff) | |
| signature | ||
move core modules to src/core_modules, make them uneffected by white/black list
Diffstat (limited to 'src/core_modules/ircv3_msgid.py')
| -rw-r--r-- | src/core_modules/ircv3_msgid.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core_modules/ircv3_msgid.py b/src/core_modules/ircv3_msgid.py new file mode 100644 index 00000000..f95f9fd4 --- /dev/null +++ b/src/core_modules/ircv3_msgid.py @@ -0,0 +1,31 @@ +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") + @utils.hook("send.message.channel") + @utils.hook("received.notice.channel") + @utils.hook("send.notice.channel") + @utils.hook("received.tagmsg.channel") + @utils.hook("send.tagmsg.channel") + def on_channel(self, event): + 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"]) + + @utils.hook("postprocess.command") + def postprocess_command(self, event): + msgid = TAG.get_value(event["line"].tags) + if msgid: + event["tags"]["+draft/reply"] = msgid + event["tags"]["+draft/reply"] = msgid |
