Changeset

1636:7fa0c41792c7

mod_mam_muc: Fix character limit
author Kim Alvefur <zash@zash.se>
date Mon, 30 Mar 2015 01:17:35 +0200
parents 1635:b877b75eb973
children 1641:1fa25cfb0ad4
files mod_mam_muc/mod_mam_muc.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Wed Mar 25 17:52:31 2015 +0100
+++ b/mod_mam_muc/mod_mam_muc.lua	Mon Mar 30 01:17:35 2015 +0200
@@ -274,10 +274,10 @@
 		item:tag("delay", { xmlns = "urn:xmpp:delay", from = room_jid, stamp = timestamp(when) }):up(); -- XEP-0203
 		if maxchars then
 			chars = #tostring(item);
-			if chars + charcount > maxchars then
+			if maxchars - chars < 0 then
 				break
 			end
-			charcount = charcount + chars;
+			charcount = maxchars - chars;
 		end
 		history[i], i = item, i+1;
 		-- module:log("debug", tostring(item));