Diff

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
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Tue Apr 07 17:04:06 2015 +0200
+++ b/mod_mam_muc/mod_mam_muc.lua	Tue Apr 07 17:34:22 2015 +0200
@@ -266,18 +266,17 @@
 		return
 	end
 
-	local chars = 0;
 	local history, i = {}, 1;
 
 	for id, item, when in data do
 		item.attr.to = to;
 		item:tag("delay", { xmlns = "urn:xmpp:delay", from = room_jid, stamp = timestamp(when) }):up(); -- XEP-0203
 		if maxchars then
-			chars = #tostring(item);
+			local chars = #tostring(item);
 			if maxchars - chars < 0 then
 				break
 			end
-			charcount = maxchars - chars;
+			maxchars = maxchars - chars;
 		end
 		history[i], i = item, i+1;
 		-- module:log("debug", tostring(item));