aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-01-06 19:33:25 +0000
committerMatthew Wild <mwild1@gmail.com>2015-01-06 19:33:25 +0000
commit3ce10e3af3c6d5a7447e01110f0a375f9028d953 (patch)
treee1dadd72e9c4cccb091b00a98e3790bfe4568680 /plugins/muc
parentf32bdb004946ee50088eb8bb0a69f244cb2a835b (diff)
downloadprosody-3ce10e3af3c6d5a7447e01110f0a375f9028d953.tar.gz
prosody-3ce10e3af3c6d5a7447e01110f0a375f9028d953.zip
mod_muc: Add muc-add-history event to allow modules to override default history storage
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/history.lib.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua
index 4129e7fa..d685abf2 100644
--- a/plugins/muc/history.lib.lua
+++ b/plugins/muc/history.lib.lua
@@ -135,7 +135,7 @@ module:hook("muc-occupant-session-new", function(event)
end, 50); -- Before subject(20)
-- add to history
-module:hook("muc-broadcast-message", function(event)
+module:hook("muc-add-history", function(event)
local historic = event.stanza:get_child("body");
if historic then
local room = event.room
@@ -151,6 +151,13 @@ module:hook("muc-broadcast-message", function(event)
table.insert(history, entry);
while #history > get_historylength(room) do table.remove(history, 1) end
end
+ return true;
+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)
+ module:fire_event("muc-add-history", event);
end);
return {