Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 8661:7fc0784491ef
MUC: Override methods on broken rooms to return internal-server-error instead
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 22 Mar 2018 20:08:32 +0100 |
parent | 8660:3b54f8472b51 |
child | 8662:a4e63b037a2a |
comparison
equal
deleted
inserted
replaced
8660:3b54f8472b51 | 8661:7fc0784491ef |
---|---|
151 return room; | 151 return room; |
152 end | 152 end |
153 return false; | 153 return false; |
154 end | 154 end |
155 | 155 |
156 local function handle_broken_room(room, origin, stanza) | |
157 module:log("debug", "Returning error from broken room %s", room.jid); | |
158 origin.send(st.error_reply(stanza, "wait", "internal-server-error")); | |
159 return true; | |
160 end | |
161 | |
156 local function restore_room(jid) | 162 local function restore_room(jid) |
157 local node = jid_split(jid); | 163 local node = jid_split(jid); |
158 local data, err = room_configs:get(node); | 164 local data, err = room_configs:get(node); |
159 if data then | 165 if data then |
160 module:log("debug", "Restoring room %s from storage", jid); | 166 module:log("debug", "Restoring room %s from storage", jid); |
165 local room = muclib.restore_room(data, state); | 171 local room = muclib.restore_room(data, state); |
166 return track_room(room); | 172 return track_room(room); |
167 elseif err then | 173 elseif err then |
168 module:log("error", "Error restoring room %s from storage: %s", jid, err); | 174 module:log("error", "Error restoring room %s from storage: %s", jid, err); |
169 local room = muclib.new_room(jid, { locked = math.huge }); | 175 local room = muclib.new_room(jid, { locked = math.huge }); |
176 room.handle_normal_presence = handle_broken_room; | |
177 room.handle_first_presence = handle_broken_room; | |
170 return room; | 178 return room; |
171 end | 179 end |
172 end | 180 end |
173 | 181 |
174 function forget_room(room) | 182 function forget_room(room) |