Mercurial > prosody-hg
comparison plugins/muc/mod_muc.lua @ 9013:a54bcc76cd22
MUC: Remove room state on successful restoration from disk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 11 Jul 2018 03:27:18 +0200 |
| parents | 295faf1522f9 |
| children | dc606dc89f44 |
comparison
equal
deleted
inserted
replaced
| 9012:295faf1522f9 | 9013:a54bcc76cd22 |
|---|---|
| 186 local state, s_err = room_state:get(node); | 186 local state, s_err = room_state:get(node); |
| 187 if not state and s_err then | 187 if not state and s_err then |
| 188 module:log("debug", "Could not restore state of room %s: %s", jid, s_err); | 188 module:log("debug", "Could not restore state of room %s: %s", jid, s_err); |
| 189 end | 189 end |
| 190 local room = muclib.restore_room(data, state); | 190 local room = muclib.restore_room(data, state); |
| 191 return track_room(room); | 191 if track_room(room) then |
| 192 room_state:set(node, nil); | |
| 193 return room; | |
| 194 else | |
| 195 return false; | |
| 196 end | |
| 192 elseif err then | 197 elseif err then |
| 193 module:log("error", "Error restoring room %s from storage: %s", jid, err); | 198 module:log("error", "Error restoring room %s from storage: %s", jid, err); |
| 194 local room = muclib.new_room(jid, { locked = math.huge }); | 199 local room = muclib.new_room(jid, { locked = math.huge }); |
| 195 room.handle_normal_presence = handle_broken_room; | 200 room.handle_normal_presence = handle_broken_room; |
| 196 room.handle_first_presence = handle_broken_room; | 201 room.handle_first_presence = handle_broken_room; |
