Comparison

mod_mam/mod_mam.lua @ 1113:f1f0c87cffdd

mod_mam: Neater reply building
author Kim Alvefur <zash@zash.se>
date Fri, 12 Jul 2013 23:18:30 +0200
parent 1112:1dc07833355e
child 1114:6c0e1f9926f6
comparison
equal deleted inserted replaced
1112:1dc07833355e 1113:f1f0c87cffdd
211 origin.send(v); 211 origin.send(v);
212 end 212 end
213 -- That's all folks! 213 -- That's all folks!
214 module:log("debug", "Archive query %s completed", tostring(qid)); 214 module:log("debug", "Archive query %s completed", tostring(qid));
215 215
216 local reply = st.reply(stanza); 216 return origin.send(st.reply(stanza)
217 if last then 217 :query(xmlns_mam):add_child(rsm.generate {
218 -- This is a bit redundant, isn't it? 218 first = (reverse and last or first), last = (reverse and first or last), count = #data}));
219 reply:query(xmlns_mam):add_child(rsm.generate{first = (reverse and last or first), last = (reverse and first or last), count = #data});
220 end
221 origin.send(reply);
222 return true
223 end); 219 end);
224 220
225 local function has_in_roster(user, who) 221 local function has_in_roster(user, who)
226 local roster = rm_load_roster(user, host); 222 local roster = rm_load_roster(user, host);
227 module:log("debug", "%s has %s in roster? %s", user, who, roster[who] and "yes" or "no"); 223 module:log("debug", "%s has %s in roster? %s", user, who, roster[who] and "yes" or "no");