From 52387900bc55261ff7defca5e1bbbd02e4688cf5 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 14 Feb 2019 21:51:51 +0000 Subject: [PATCH] Support `draft/delivered` and `draft/read` (message_tracking.py) --- modules/message_tracking.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 modules/message_tracking.py diff --git a/modules/message_tracking.py b/modules/message_tracking.py new file mode 100644 index 00000000..253e5426 --- /dev/null +++ b/modules/message_tracking.py @@ -0,0 +1,17 @@ +from src import ModuleManager, utils + +MSGID_TAG = "draft/msgid" +READ_TAG = "+draft/read" +DELIVERED_TAG = "+draft/delivered" + +class Module(ModuleManager.BaseModule): + @utils.hook("received.message.private") + @utils.hook("received.message.channel") + @utils.hook("received.notice.private") + @utils.hook("received.notice.channel") + def privmsg(self, event): + if MSGID_TAG in event["tags"]: + target = event.get("channel", event["user"]) + msgid = event["tags"][MSGID_TAG] + tags = {DELIVERED_TAG: msgid, READ_TAG: msgid} + server.send_tagmsg(target.name, tags)