# HG changeset patch
# User Kim Alvefur <[email protected]>
# Date 1525723829 -7200
# Mon May 07 22:10:29 2018 +0200
# Node ID 4cab4ee5dfcc4beb693a8ab5fbd05e3b0d0c365c
# Parent 11b4ae162db7b6b29a5f6d879d58aa243a17d4ca
MUC: Introduce an event to allow plugins to influence which messages are added
to history
diff -r 11b4ae162db7 -r 4cab4ee5dfcc plugins/muc/history.lib.lua
--- a/plugins/muc/history.lib.lua Mon May 07 22:12:22 2018 +0200
+++ b/plugins/muc/history.lib.lua Mon May 07 22:10:29 2018 +0200
@@ -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;
--
You received this message because you are subscribed to the Google Groups
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.