Comparison

mod_mam_muc/mod_mam_muc.lua @ 1649:ab4073468dfb

mod_mam_muc: Fix character limit again(?)
author Kim Alvefur <zash@zash.se>
date Tue, 07 Apr 2015 17:34:22 +0200
parent 1636:7fa0c41792c7
child 1650:66d67f0bae16
comparison
equal deleted inserted replaced
1648:648ce9087902 1649:ab4073468dfb
264 if not data then 264 if not data then
265 module:log("error", "Could not fetch history: %s", tostring(err)); 265 module:log("error", "Could not fetch history: %s", tostring(err));
266 return 266 return
267 end 267 end
268 268
269 local chars = 0;
270 local history, i = {}, 1; 269 local history, i = {}, 1;
271 270
272 for id, item, when in data do 271 for id, item, when in data do
273 item.attr.to = to; 272 item.attr.to = to;
274 item:tag("delay", { xmlns = "urn:xmpp:delay", from = room_jid, stamp = timestamp(when) }):up(); -- XEP-0203 273 item:tag("delay", { xmlns = "urn:xmpp:delay", from = room_jid, stamp = timestamp(when) }):up(); -- XEP-0203
275 if maxchars then 274 if maxchars then
276 chars = #tostring(item); 275 local chars = #tostring(item);
277 if maxchars - chars < 0 then 276 if maxchars - chars < 0 then
278 break 277 break
279 end 278 end
280 charcount = maxchars - chars; 279 maxchars = maxchars - chars;
281 end 280 end
282 history[i], i = item, i+1; 281 history[i], i = item, i+1;
283 -- module:log("debug", tostring(item)); 282 -- module:log("debug", tostring(item));
284 end 283 end
285 function event:next_stanza() 284 function event:next_stanza()