diff mod_mam_muc/mod_mam_muc.lua @ 2716:02a7f9fe44fa

mod_mam_muc: Rename various fields from "logging" to "archiving"
author Kim Alvefur <zash@zash.se>
date Sun, 21 May 2017 23:59:36 +0200
parents fbb26a56a667
children 02d688ba7739
line wrap: on
line diff
--- a/mod_mam_muc/mod_mam_muc.lua	Fri May 12 23:41:31 2017 +0200
+++ b/mod_mam_muc/mod_mam_muc.lua	Sun May 21 23:59:36 2017 +0200
@@ -12,7 +12,7 @@
 local xmlns_delay   = "urn:xmpp:delay";
 local xmlns_forward = "urn:xmpp:forward:0";
 local xmlns_st_id   = "urn:xmpp:sid:0";
-local muc_form_enable_logging = "muc#roomconfig_enablelogging"
+local muc_form_enable = "muc#roomconfig_enablearchiving"
 
 local st = require "util.stanza";
 local rsm = require "util.rsm";
@@ -61,11 +61,11 @@
 	return false;
 end
 
-local function logging_enabled(room)
+local function archiving_enabled(room)
 	if log_all_rooms then
 		return true;
 	end
-	local enabled = room._data.logging;
+	local enabled = room._data.archiving;
 	if enabled == nil then
 		return log_by_default;
 	end
@@ -78,7 +78,7 @@
 if not new_muc then -- 0.10 or older
 	module:hook("muc-room-created", function (event)
 		local room = event.room;
-		if logging_enabled(room) then
+		if archiving_enabled(room) then
 			room.send_history = send_history;
 			room.save_to_history = save_to_history;
 		end
@@ -86,7 +86,7 @@
 
 	function module.load()
 		for room in each_room() do
-			if logging_enabled(room) then
+			if archiving_enabled(room) then
 				room.send_history = send_history;
 				room.save_to_history = save_to_history;
 			end
@@ -107,21 +107,21 @@
 		local room, form = event.room, event.form;
 		table.insert(form,
 		{
-			name = muc_form_enable_logging,
+			name = muc_form_enable,
 			type = "boolean",
-			label = "Enable Logging?",
-			value = logging_enabled(room),
+			label = "Enable archiving?",
+			value = archiving_enabled(room),
 		}
 		);
 	end);
 
 	module:hook("muc-config-submitted", function(event)
 		local room, fields, changed = event.room, event.fields, event.changed;
-		local new = fields[muc_form_enable_logging];
-		if new ~= room._data.logging then
-			room._data.logging = new;
+		local new = fields[muc_form_enable];
+		if new ~= room._data.archiving then
+			room._data.archiving = new;
 			if type(changed) == "table" then
-				changed[muc_form_enable_logging] = true;
+				changed[muc_form_enable] = true;
 			else
 				event.changed = true;
 			end
@@ -276,7 +276,7 @@
 
 module:hook("muc-get-history", function (event)
 	local room = event.room;
-	if not logging_enabled(room) then return end
+	if not archiving_enabled(room) then return end
 	local room_jid = room.jid;
 	local maxstanzas = event.maxstanzas;
 	local maxchars = event.maxchars;
@@ -366,7 +366,7 @@
 	end);
 
 	-- Policy check
-	if not logging_enabled(self) then return end -- Don't log
+	if not archiving_enabled(self) then return end -- Don't log
 
 	-- And stash it
 	local with = stanza.name