Comparison

plugins/muc/muc.lib.lua @ 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
parent 7444:45d28235ebe0
child 7631:f50c039d6bb1
comparison
equal deleted inserted replaced
7477:f9e470026042 7488:cdabf8199903
1302 _data = config or {}; 1302 _data = config or {};
1303 _affiliations = {}; 1303 _affiliations = {};
1304 }, room_mt); 1304 }, room_mt);
1305 end 1305 end
1306 1306
1307 local new_format = module:get_option_boolean("new_muc_storage_format", false);
1308
1307 function room_mt:freeze(live) 1309 function room_mt:freeze(live)
1308 local frozen, state = { 1310 local frozen, state;
1309 _jid = self.jid; 1311 if new_format then
1310 _data = self._data; 1312 frozen = {
1311 }; 1313 _jid = self.jid;
1312 for user, affiliation in pairs(self._affiliations) do 1314 _data = self._data;
1313 frozen[user] = affiliation; 1315 };
1316 for user, affiliation in pairs(self._affiliations) do
1317 frozen[user] = affiliation;
1318 end
1319 else
1320 frozen = {
1321 jid = self.jid;
1322 _data = self._data;
1323 _affiliations = self._affiliations;
1324 };
1314 end 1325 end
1315 if live then 1326 if live then
1316 state = {}; 1327 state = {};
1317 for nick, occupant in self:each_occupant() do 1328 for nick, occupant in self:each_occupant() do
1318 state[nick] = { 1329 state[nick] = {