From b4e3ee5d0ee070c3bd0f4b9270fa68d903c89d0e Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 17 Jan 2020 16:28:48 +0000 Subject: [PATCH] pass draft/delete events through to format_activity/print_activity --- modules/ircv3_editmsg.py | 20 +++++++++++++++++--- src/core_modules/print_activity.py | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/ircv3_editmsg.py b/modules/ircv3_editmsg.py index 9d27cc6e..458ac61a 100644 --- a/modules/ircv3_editmsg.py +++ b/modules/ircv3_editmsg.py @@ -5,11 +5,25 @@ DELETE_TAG = utils.irc.MessageTag(None, "draft/delete") @utils.export("cap", CAP) class Module(ModuleManager.BaseModule): - @utils.hook("received.tagmsg.private") - @utils.hook("received.tagmsg.channel") - def tagmsg(self, event): + def _tagmsg(self, event, channel): msgid = DELETE_TAG.get_value(event["line"].tags) if msgid: line = event["target"].buffer.find_id(msgid) if line: line.deleted = True + + timestamp = utils.datetime.datetime_human(line.timestamp) + minimal = "{NICK} deleted line from %s (%s)" % ( + timestamp, line.message) + line = "- %s" % minimal + + self.exports.get_one("format")("delete", event["server"], line, + event["target_str"], minimal=minimal, channel=channel, + user=event["user"]) + + @utils.hook("received.tagmsg.private") + def private(self, event): + self._tagmsg(event, None) + @utils.hook("received.tagmsg.channel") + def channel(self, event): + self._tagmsg(event, event["target"]) diff --git a/src/core_modules/print_activity.py b/src/core_modules/print_activity.py index e6a34992..b1b9c74d 100644 --- a/src/core_modules/print_activity.py +++ b/src/core_modules/print_activity.py @@ -39,6 +39,7 @@ class Module(ModuleManager.BaseModule): @utils.hook("formatted.quit") @utils.hook("formatted.rename") @utils.hook("formatted.chghost") + @utils.hook("formatted.delete") def formatted(self, event): self._print(event)