# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1431911022 -7200
# Node ID 5734a619993879f762198d1a5545c72a9a5d679c
# Parent  851cb0b3d5844bd4404c74ad8e9a0ee84c5190d2
mod_mam: Fire event on successful storage of message

diff -r 851cb0b3d584 -r 5734a6199938 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