Diff

plugins/muc/mod_muc.lua @ 4528:875b90d5ce0f

muc - implement per channel history limits - allow configuration via channel settings - store the settings for permanent channels - honor muc max_history_messages from the config as upper limit - only broadcast_message with historic = true if history_length is > 0
author Markus Kötter <koetter@rrzn-hiwi.uni-hannover.de>
date Fri, 13 Apr 2012 21:23:26 +0200
parent 4370:be14f96290a4
child 4924:d8b9fe5900a2
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Mon Mar 05 22:11:29 2012 +0100
+++ b/plugins/muc/mod_muc.lua	Fri Apr 13 21:23:26 2012 +0200
@@ -69,10 +69,10 @@
 	local node = jid_split(jid);
 	local data = datamanager.load(node, muc_host, "config") or {};
 	local room = muc_new_room(jid, {
-		history_length = max_history_messages;
+		max_history_length = max_history_messages;
 	});
 	room._data = data._data;
-	room._data.history_length = max_history_messages; --TODO: Need to allow per-room with a global limit
+	room._data.max_history_length = max_history_messages; -- Overwrite old max_history_length in data with current settings
 	room._affiliations = data._affiliations;
 	room.route_stanza = room_route_stanza;
 	room.save = room_save;
@@ -80,7 +80,7 @@
 end
 
 local host_room = muc_new_room(muc_host, {
-	history_length = max_history_messages;
+	max_history_length = max_history_messages;
 });
 host_room.route_stanza = room_route_stanza;
 host_room.save = room_save;
@@ -131,7 +131,7 @@
 		  (restrict_room_creation == "admin" and is_admin(stanza.attr.from)) or
 		  (restrict_room_creation == "local" and select(2, jid_split(stanza.attr.from)) == module.host:gsub("^[^%.]+%.", "")) then
 			room = muc_new_room(bare, {
-				history_length = max_history_messages;
+				max_history_length = max_history_messages;
 			});
 			room.route_stanza = room_route_stanza;
 			room.save = room_save;