changeset 1641:1fa25cfb0ad4

Merge
author Kim Alvefur <zash@zash.se>
date Tue, 31 Mar 2015 18:31:13 +0200
parents 7fa0c41792c7 (diff) 1d96629f5dda (current diff)
children a4a6b4be973a
files
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Tue Mar 31 12:46:17 2015 +0100
+++ b/mod_mam_muc/mod_mam_muc.lua	Tue Mar 31 18:31:13 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));