Mercurial > prosody-modules
comparison mod_mam_muc/mod_mam_muc.lua @ 1636:7fa0c41792c7
mod_mam_muc: Fix character limit
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 30 Mar 2015 01:17:35 +0200 |
parents | 458c80904525 |
children | ab4073468dfb |
comparison
equal
deleted
inserted
replaced
1635:b877b75eb973 | 1636:7fa0c41792c7 |
---|---|
272 for id, item, when in data do | 272 for id, item, when in data do |
273 item.attr.to = to; | 273 item.attr.to = to; |
274 item:tag("delay", { xmlns = "urn:xmpp:delay", from = room_jid, stamp = timestamp(when) }):up(); -- XEP-0203 | 274 item:tag("delay", { xmlns = "urn:xmpp:delay", from = room_jid, stamp = timestamp(when) }):up(); -- XEP-0203 |
275 if maxchars then | 275 if maxchars then |
276 chars = #tostring(item); | 276 chars = #tostring(item); |
277 if chars + charcount > maxchars then | 277 if maxchars - chars < 0 then |
278 break | 278 break |
279 end | 279 end |
280 charcount = charcount + chars; | 280 charcount = maxchars - chars; |
281 end | 281 end |
282 history[i], i = item, i+1; | 282 history[i], i = item, i+1; |
283 -- module:log("debug", tostring(item)); | 283 -- module:log("debug", tostring(item)); |
284 end | 284 end |
285 function event:next_stanza() | 285 function event:next_stanza() |