Changeset

1382:ba17268490b7

mod_mam_muc: Fix to, from on result messages (thanks daurnimator)
author Kim Alvefur <zash@zash.se>
date Tue, 08 Apr 2014 17:28:08 +0200
parents 1381:11b6170a50f7
children 1383:465e5d79551b
files mod_mam_muc/mod_mam_muc.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Sat Apr 05 13:41:12 2014 +0200
+++ b/mod_mam_muc/mod_mam_muc.lua	Tue Apr 08 17:28:08 2014 +0200
@@ -116,13 +116,14 @@
 	local origin, stanza = event.origin, event.stanza;
 	local room = stanza.attr.to;
 	local room_node = jid_split(room);
+	local orig_from = stanza.attr.from;
 	local query = stanza.tags[1];
 
 	local room_obj = rooms[room];
 	if not room_obj then
 		return origin.send(st.error_reply(stanza, "cancel", "item-not-found"))
 	end
-	local from = jid_bare(stanza.attr.from);
+	local from = jid_bare(orig_from);
 
 	-- Banned or not a member of a members-only room?
 	local from_affiliation = room_obj:get_affiliation(from);
@@ -173,7 +174,7 @@
 	-- Wrap it in stuff and deliver
 	local first, last;
 	for id, item, when in data do
-		local fwd_st = st.message{ to = origin.full_jid }
+		local fwd_st = st.message{ to = orig_from, from = room }
 			:tag("result", { xmlns = xmlns_mam, queryid = qid, id = id })
 				:tag("forwarded", { xmlns = xmlns_forward })
 					:tag("delay", { xmlns = xmlns_delay, stamp = timestamp(when) }):up();