pass draft/delete events through to format_activity/print_activity
This commit is contained in:
parent
95668f2b8b
commit
b4e3ee5d0e
2 changed files with 18 additions and 3 deletions
|
@ -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"])
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue