aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/mod_muc.lua6
-rw-r--r--plugins/muc/muc.lib.lua8
-rw-r--r--plugins/muc/subject.lib.lua1
3 files changed, 10 insertions, 5 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 7ecd6490..c8723c16 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -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);
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 42a0af25..2026bc47 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -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;
diff --git a/plugins/muc/subject.lib.lua b/plugins/muc/subject.lib.lua
index 8f5f9231..45aa6934 100644
--- a/plugins/muc/subject.lib.lua
+++ b/plugins/muc/subject.lib.lua
@@ -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"));