changeset 1534:4dd6eebc8fbd

mod_mam_muc: Minor moving about of variables
author Kim Alvefur <zash@zash.se>
date Wed, 22 Oct 2014 19:32:52 +0200
parents 915bdcb35e79
children efbb047c01e7
files mod_mam_muc/mod_mam_muc.lua
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Wed Oct 22 19:29:29 2014 +0200
+++ b/mod_mam_muc/mod_mam_muc.lua	Wed Oct 22 19:32:52 2014 +0200
@@ -12,7 +12,10 @@
 local rsm = module:require "mod_mam/rsm";
 local jid_bare = require "util.jid".bare;
 local jid_split = require "util.jid".split;
-local room_mt = module:depends"muc".room_mt;
+
+local mod_muc = module:depends"muc";
+local room_mt = mod_muc.room_mt;
+local rooms = mod_muc.rooms;
 
 local getmetatable = getmetatable;
 local function is_stanza(x)
@@ -40,8 +43,6 @@
         return
 end
 
-local rooms = hosts[module.host].modules.muc.rooms;
-
 local send_history, save_to_history;
 
 	-- Override history methods for all rooms.
@@ -168,10 +169,12 @@
 	end
 	local count = err;
 
+	local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to };
+
 	-- Wrap it in stuff and deliver
-	local first, last;
+	local fwd_st, first, last;
 	for id, item, when in data do
-		local fwd_st = st.message{ to = orig_from, from = room }
+		fwd_st = st.message(msg_reply_attr)
 			:tag("result", { xmlns = xmlns_mam, queryid = qid, id = id })
 				:tag("forwarded", { xmlns = xmlns_forward })
 					:tag("delay", { xmlns = xmlns_delay, stamp = timestamp(when) }):up();