Changeset

702:d94ee0848b27

mod_mam: Fix issue with get_text() and clean some unneeded variables.
author Kim Alvefur <zash@zash.se>
date Fri, 08 Jun 2012 05:56:24 +0200
parents 701:cc5805f83583
children 703:7e065836c3f6
files mod_mam/mod_mam.lua mod_mam/rsm.lib.lua
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam/mod_mam.lua	Fri Jun 08 03:13:31 2012 +0200
+++ b/mod_mam/mod_mam.lua	Fri Jun 08 05:56:24 2012 +0200
@@ -146,7 +146,6 @@
 		for i=start,#data do
 			local item = data[i];
 			local when, with, with_bare = item.when, item.with, item.with_bare;
-			local ts = item.timestamp;
 			local id = item.id;
 			--module:log("debug", "id is %s", id);
 
@@ -168,7 +167,7 @@
 				local fwd_st = st.message{ to = origin.full_jid }
 					:tag("result", { xmlns = xmlns_mam, queryid = qid, id = id }):up()
 					:tag("forwarded", { xmlns = xmlns_forward })
-						:tag("delay", { xmlns = xmlns_delay, stamp = ts or timestamp(when) }):up();
+						:tag("delay", { xmlns = xmlns_delay, stamp = timestamp(when) }):up();
 				local orig_stanza = st.deserialize(item.stanza);
 				orig_stanza.attr.xmlns = "jabber:client";
 				fwd_st:add_child(orig_stanza);
@@ -198,7 +197,7 @@
 		end
 		-- That's all folks!
 		module:log("debug", "Archive query %s completed", tostring(qid));
-		origin.send(st.reply(stanza):add_child(rsm.generate{first = { index = index; first }, last = last}));
+		origin.send(st.reply(stanza):add_child(rsm.generate{last = last}));
 		return true
 	end
 end);
--- a/mod_mam/rsm.lib.lua	Fri Jun 08 03:13:31 2012 +0200
+++ b/mod_mam/rsm.lib.lua	Fri Jun 08 05:56:24 2012 +0200
@@ -9,7 +9,7 @@
 
 do
 	local function xs_int(st)
-		return tonumber(st:get_text());
+		return tonumber((st:get_text()));
 	end
 	local function xs_string(st)
 		return st:get_text();