aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-05-07 22:10:29 +0200
committerKim Alvefur <zash@zash.se>2018-05-07 22:10:29 +0200
commit814f998b90f4b214f7b89f3d8d1d0032f9a2e78a (patch)
tree21c6c81e7b0441dbefcce66a72986ee1f45ce4d5 /plugins
parentc9a4b55656cbdb49287a08029ccb96bbed6228e5 (diff)
downloadprosody-814f998b90f4b214f7b89f3d8d1d0032f9a2e78a.tar.gz
prosody-814f998b90f4b214f7b89f3d8d1d0032f9a2e78a.zip
MUC: Introduce an event to allow plugins to influence which messages are added to history
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/history.lib.lua7
1 files changed, 5 insertions, 2 deletions
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;