From d6ed959fd38c1f32aa41ba42db0061531b4703fe Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 7 May 2018 22:10:29 +0200 Subject: MUC: Introduce an event to allow plugins to influence which messages are added to history --- plugins/muc/history.lib.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua index b816bca7..b97e3f97 100644 --- a/plugins/muc/history.lib.lua +++ b/plugins/muc/history.lib.lua @@ -156,12 +156,15 @@ end, -1); -- Have a single muc-add-history event, so that plugins can mark it -- as handled without stopping other muc-broadcast-message handlers module:hook("muc-broadcast-message", function(event) - local historic = event.stanza:get_child("body"); - if historic then + if module:fire_event("muc-message-is-historic", event) then module:fire_event("muc-add-history", event); end end); +module:hook("muc-message-is-historic", function (event) + return event.stanza:get_child("body"); +end, -1); + return { set_max_length = set_max_history_length; parse_history = parse_history; -- cgit v1.2.3