diff mod_mam_muc/mod_mam_muc.lua @ 1385:da9469e68dee

mod_mam_muc: Place stanza type in 'with' column; when sending history, only send messages with type=groupchat
author daurnimator <quae@daurnimator.com>
date Tue, 15 Apr 2014 14:22:18 -0400
parents ba17268490b7
children 18f5f1b13353
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Fri Apr 11 14:58:44 2014 +0200
+++ b/mod_mam_muc/mod_mam_muc.lua	Tue Apr 15 14:22:18 2014 -0400
@@ -222,6 +222,7 @@
 		limit = m_min(maxstanzas or 20, max_history_length);
 		after = since;
 		reverse = true;
+		with = "message<groupchat";
 	});
 
 	if not data then
@@ -259,7 +260,11 @@
 
 	module:log("debug", "We're logging this")
 	-- And stash it
-	local ok, id = archive:append(room, time_now(), "", stanza);
+	local with = stanza.name
+	if stanza.attr.type then
+		with = with .. "<" .. stanza.attr.type
+	end
+	local ok, id = archive:append(room, nil, time_now(), with, stanza);
 	if ok and advertise_archive then
 		stanza:tag("archived", { xmlns = xmlns_mam, by = jid_bare(orig_to), id = id }):up();
 	end