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)
|
@utils.export("cap", CAP)
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("received.tagmsg.private")
|
def _tagmsg(self, event, channel):
|
||||||
@utils.hook("received.tagmsg.channel")
|
|
||||||
def tagmsg(self, event):
|
|
||||||
msgid = DELETE_TAG.get_value(event["line"].tags)
|
msgid = DELETE_TAG.get_value(event["line"].tags)
|
||||||
if msgid:
|
if msgid:
|
||||||
line = event["target"].buffer.find_id(msgid)
|
line = event["target"].buffer.find_id(msgid)
|
||||||
if line:
|
if line:
|
||||||
line.deleted = True
|
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.quit")
|
||||||
@utils.hook("formatted.rename")
|
@utils.hook("formatted.rename")
|
||||||
@utils.hook("formatted.chghost")
|
@utils.hook("formatted.chghost")
|
||||||
|
@utils.hook("formatted.delete")
|
||||||
def formatted(self, event):
|
def formatted(self, event):
|
||||||
self._print(event)
|
self._print(event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue