mod_mam: Fire event on successful storage of message
authorKim Alvefur <zash@zash.se>
Mon, 18 May 2015 03:03:42 +0200
changeset 1750 5734a6199938
parent 1749 851cb0b3d584
child 1751 985e05ac833b
mod_mam: Fire event on successful storage of message
mod_mam/mod_mam.lua
--- a/mod_mam/mod_mam.lua	Mon May 18 02:58:17 2015 +0200
+++ b/mod_mam/mod_mam.lua	Mon May 18 03:03:42 2015 +0200
@@ -247,6 +247,9 @@
 
 		-- And stash it
 		local ok, id = archive:append(store_user, nil, time_now(), with, stanza);
+		if ok then
+			module:fire_event("archive-message-added", { origin = origin, stanza = stanza, for_user = store_user, id = id });
+		end
 	else
 		module:log("debug", "Not archiving stanza: %s (prefs)", stanza:top_tag());
 	end