Changeset

7488:cdabf8199903

MUC: Hide new MUC room storage format behind an off-by-default option
author Kim Alvefur <zash@zash.se>
date Sat, 09 Jul 2016 22:33:04 +0200
parents 7477:f9e470026042
children 7494:f82356adcd71
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Fri Jul 08 22:01:10 2016 +0200
+++ b/plugins/muc/muc.lib.lua	Sat Jul 09 22:33:04 2016 +0200
@@ -1304,13 +1304,24 @@
 	}, room_mt);
 end
 
+local new_format = module:get_option_boolean("new_muc_storage_format", false);
+
 function room_mt:freeze(live)
-	local frozen, state = {
-		_jid = self.jid;
-		_data = self._data;
-	};
-	for user, affiliation in pairs(self._affiliations) do
-		frozen[user] = affiliation;
+	local frozen, state;
+	if new_format then
+		frozen = {
+			_jid = self.jid;
+			_data = self._data;
+		};
+		for user, affiliation in pairs(self._affiliations) do
+			frozen[user] = affiliation;
+		end
+	else
+		frozen = {
+			jid = self.jid;
+			_data = self._data;
+			_affiliations = self._affiliations;
+		};
 	end
 	if live then
 		state = {};