Merge with Link Mauve
authorKim Alvefur <zash@zash.se>
Sun, 17 Apr 2016 20:28:48 +0000 (22:28 +0200)
committerKim Alvefur <zash@zash.se>
Sun, 17 Apr 2016 20:28:48 +0000 (22:28 +0200)
plugins/muc/mod_muc.lua
plugins/muc/muc.lib.lua
plugins/muc/subject.lib.lua

index 7ecd649051974b843f8ea710b90174706fa82d2a..c8723c162f8a0d198ef0bf2417d5171e76157b3f 100644 (file)
@@ -102,11 +102,7 @@ local function room_save(room, forced)
        local is_persistent = persistent.get(room);
        persistent_rooms:set(nil, room.jid, is_persistent);
        if is_persistent then
-               local data = {
-                       jid = room.jid;
-                       _data = room._data;
-                       _affiliations = room._affiliations;
-               };
+               local data = room:freeze();
                room_configs:set(node, data);
        elseif forced then
                room_configs:set(node, nil);
index 42a0af25c9062c5b44281af4f5e4ab1a805c72c8..2026bc4717c668adc0def9bf16712c6767e8eefd 100644 (file)
@@ -1235,6 +1235,14 @@ function _M.new_room(jid, config) -- luacheck: ignore 212
        }, room_mt);
 end
 
+function room_mt:freeze()
+       return {
+               jid = self.jid;
+               _data = self._data;
+               _affiliations = self._affiliations;
+       }
+end
+
 _M.room_mt = room_mt;
 
 return _M;
index 8f5f923184c946c61c961db348d08211ee72fe7b..45aa6934ebf4d15b6ea583acedecf65599dbf2d3 100644 (file)
@@ -82,6 +82,7 @@ module:hook("muc-occupant-groupchat", function(event)
                if role_rank >= valid_roles.moderator or
                        ( role_rank >= valid_roles.participant and get_changesubject(event.room) ) then -- and participant
                        set_subject(event.room, occupant.nick, subject:get_text());
+                       room:save();
                        return true;
                else
                        event.origin.send(st.error_reply(stanza, "auth", "forbidden"));