2019-06-02 14:18:49 +00:00
|
|
|
from src import ModuleManager, utils
|
|
|
|
|
|
|
|
TAG = utils.irc.MessageTag("msgid", "draft/msgid")
|
|
|
|
|
|
|
|
class Module(ModuleManager.BaseModule):
|
2019-06-03 13:10:25 +00:00
|
|
|
def _on_channel(self, channel, tags):
|
|
|
|
msgid = TAG.get_value(tags)
|
|
|
|
if not msgid == None:
|
|
|
|
channel.set_setting("last-msgid", msgid)
|
|
|
|
|
2019-06-02 14:18:49 +00:00
|
|
|
@utils.hook("received.message.channel")
|
2019-06-21 09:47:39 +00:00
|
|
|
@utils.hook("send.message.channel")
|
2019-06-02 14:18:49 +00:00
|
|
|
@utils.hook("received.notice.channel")
|
2019-06-21 09:47:39 +00:00
|
|
|
@utils.hook("send.notice.channel")
|
2019-06-02 14:18:49 +00:00
|
|
|
@utils.hook("received.tagmsg.channel")
|
2019-06-21 09:47:39 +00:00
|
|
|
@utils.hook("send.tagmsg.channel")
|
2019-06-02 14:18:49 +00:00
|
|
|
def on_channel(self, event):
|
2019-06-03 13:10:25 +00:00
|
|
|
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"])
|
2019-11-22 16:23:30 +00:00
|
|
|
|
|
|
|
@utils.hook("postprocess.command")
|
|
|
|
def postprocess_command(self, event):
|
|
|
|
msgid = TAG.get_value(event["line"].tags)
|
|
|
|
if msgid:
|
2019-11-25 16:28:03 +00:00
|
|
|
event["tags"]["+draft/reply"] = msgid
|
|
|
|
event["tags"]["+draft/reply"] = msgid
|