mod_mam: Neater reply building
authorKim Alvefur <zash@zash.se>
Fri, 12 Jul 2013 23:18:30 +0200
changeset 1113 f1f0c87cffdd
parent 1112 1dc07833355e
child 1114 6c0e1f9926f6
mod_mam: Neater reply building
mod_mam/mod_mam.lua
--- a/mod_mam/mod_mam.lua	Fri Jul 12 22:54:41 2013 +0200
+++ b/mod_mam/mod_mam.lua	Fri Jul 12 23:18:30 2013 +0200
@@ -213,13 +213,9 @@
 	-- That's all folks!
 	module:log("debug", "Archive query %s completed", tostring(qid));
 
-	local reply = st.reply(stanza);
-	if last then
-		-- This is a bit redundant, isn't it?
-		reply:query(xmlns_mam):add_child(rsm.generate{first = (reverse and last or first), last = (reverse and first or last), count = #data});
-	end
-	origin.send(reply);
-	return true
+	return origin.send(st.reply(stanza)
+		:query(xmlns_mam):add_child(rsm.generate {
+			first = (reverse and last or first), last = (reverse and first or last), count = #data}));
 end);
 
 local function has_in_roster(user, who)