aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-07-10 21:10:12 +0200
committerKim Alvefur <zash@zash.se>2018-07-10 21:10:12 +0200
commit4bf97ac79117224af094aad2fd7b8c0ed4b07785 (patch)
treeb608965741f9422c396a5e4be447cf5dd9f87c4c
parent804606ae7567d7e094180c987112897466f053b4 (diff)
downloadprosody-4bf97ac79117224af094aad2fd7b8c0ed4b07785.tar.gz
prosody-4bf97ac79117224af094aad2fd7b8c0ed4b07785.zip
MUC: Flag rooms being destroyed (fixes #887)
-rw-r--r--plugins/muc/mod_muc.lua1
-rw-r--r--plugins/muc/muc.lib.lua1
2 files changed, 2 insertions, 0 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index a260823d..ad937bc4 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -156,6 +156,7 @@ end);
-- Automatically destroy empty non-persistent rooms
module:hook("muc-occupant-left",function(event)
local room = event.room
+ if room.destroying then return end
if not room:has_occupant() and not persistent.get(room) then -- empty, non-persistent room
module:fire_event("muc-room-destroyed", { room = room });
end
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 58853e66..b61d72b9 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -848,6 +848,7 @@ function room_mt:destroy(newjid, reason, password)
if reason then x:tag("reason"):text(reason):up(); end
if password then x:tag("password"):text(password):up(); end
x:up();
+ self.destroying = reason or true;
self:clear(x);
module:fire_event("muc-room-destroyed", { room = self });
return true;