Comparison

mod_mam/mod_mam.lua @ 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
parent 701:cc5805f83583
child 705:c9d0ba39a33b
comparison
equal deleted inserted replaced
701:cc5805f83583 702:d94ee0848b27
144 144
145 module:log("debug", "Loaded %d items, about to filter", #data); 145 module:log("debug", "Loaded %d items, about to filter", #data);
146 for i=start,#data do 146 for i=start,#data do
147 local item = data[i]; 147 local item = data[i];
148 local when, with, with_bare = item.when, item.with, item.with_bare; 148 local when, with, with_bare = item.when, item.with, item.with_bare;
149 local ts = item.timestamp;
150 local id = item.id; 149 local id = item.id;
151 --module:log("debug", "id is %s", id); 150 --module:log("debug", "id is %s", id);
152 151
153 -- RSM pre-send-checking 152 -- RSM pre-send-checking
154 if qset then 153 if qset then
166 and (not qend or when <= qend) 165 and (not qend or when <= qend)
167 and (not qset or qset_matches) then 166 and (not qset or qset_matches) then
168 local fwd_st = st.message{ to = origin.full_jid } 167 local fwd_st = st.message{ to = origin.full_jid }
169 :tag("result", { xmlns = xmlns_mam, queryid = qid, id = id }):up() 168 :tag("result", { xmlns = xmlns_mam, queryid = qid, id = id }):up()
170 :tag("forwarded", { xmlns = xmlns_forward }) 169 :tag("forwarded", { xmlns = xmlns_forward })
171 :tag("delay", { xmlns = xmlns_delay, stamp = ts or timestamp(when) }):up(); 170 :tag("delay", { xmlns = xmlns_delay, stamp = timestamp(when) }):up();
172 local orig_stanza = st.deserialize(item.stanza); 171 local orig_stanza = st.deserialize(item.stanza);
173 orig_stanza.attr.xmlns = "jabber:client"; 172 orig_stanza.attr.xmlns = "jabber:client";
174 fwd_st:add_child(orig_stanza); 173 fwd_st:add_child(orig_stanza);
175 origin.send(fwd_st); 174 origin.send(fwd_st);
176 if not first then 175 if not first then
196 end 195 end
197 end 196 end
198 end 197 end
199 -- That's all folks! 198 -- That's all folks!
200 module:log("debug", "Archive query %s completed", tostring(qid)); 199 module:log("debug", "Archive query %s completed", tostring(qid));
201 origin.send(st.reply(stanza):add_child(rsm.generate{first = { index = index; first }, last = last})); 200 origin.send(st.reply(stanza):add_child(rsm.generate{last = last}));
202 return true 201 return true
203 end 202 end
204 end); 203 end);
205 204
206 local function has_in_roster(user, who) 205 local function has_in_roster(user, who)