Comparison

plugins/muc/mod_muc.lua @ 8656:0e84814a7ece

MUC: Produce an untracked, locked room on failure to read room from storage (#1091)
author Kim Alvefur <zash@zash.se>
date Mon, 12 Mar 2018 21:47:39 +0100
parent 8572:ce1737520943
child 8657:a804f2e75f10
comparison
equal deleted inserted replaced
8655:ba6a6a04b46c 8656:0e84814a7ece
146 room.save = room_save; 146 room.save = room_save;
147 end 147 end
148 148
149 local function restore_room(jid) 149 local function restore_room(jid)
150 local node = jid_split(jid); 150 local node = jid_split(jid);
151 local data = room_configs:get(node); 151 local data, err = room_configs:get(node);
152 local state = room_state:get(node); 152 local state = room_state:get(node);
153 if data then 153 if data then
154 module:log("debug", "Restoring room %s from storage", jid); 154 module:log("debug", "Restoring room %s from storage", jid);
155 local room = muclib.restore_room(data, state); 155 local room = muclib.restore_room(data, state);
156 track_room(room); 156 track_room(room);
157 return room;
158 elseif err then
159 module:log("error", "Error restoring room %s from storage: %s", jid, err);
160 local room = muclib.new_room(jid, { locked = math.huge });
157 return room; 161 return room;
158 end 162 end
159 end 163 end
160 164
161 function forget_room(room) 165 function forget_room(room)