comparison mod_groups_internal/mod_groups_internal.lua @ 5821:c9279845fc41

mod_groups_internal: Save MUC room after creation to commit it to storage Without this, the MUC could be lost on an unclean shutdown.
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Jan 2024 15:37:13 +0000
parents 742142f9771e
children fe3bde6ef95a
comparison
equal deleted inserted replaced
5820:742142f9771e 5821:c9279845fc41
295 local mucs = group_info.mucs or {}; 295 local mucs = group_info.mucs or {};
296 296
297 -- Create the MUC 297 -- Create the MUC
298 local muc_jid, room = _create_muc_room(name); 298 local muc_jid, room = _create_muc_room(name);
299 if not muc_jid then return nil, room; end 299 if not muc_jid then return nil, room; end
300 room:save(); -- This ensures the room is committed to storage
301
300 table.insert(mucs, muc_jid); 302 table.insert(mucs, muc_jid);
301 if group_info.muc_jid then -- COMPAT include old muc_jid into array 303 if group_info.muc_jid then -- COMPAT include old muc_jid into array
302 table.insert(mucs, group_info.muc_jid); 304 table.insert(mucs, group_info.muc_jid);
303 end 305 end
304 local store_ok, store_err = group_info_store:set_key(group_id, "mucs", mucs); 306 local store_ok, store_err = group_info_store:set_key(group_id, "mucs", mucs);