diff 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
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));