Changeset

9007:695904638cfa

MUC: Flag rooms being destroyed (fixes #887)
author Kim Alvefur <zash@zash.se>
date Tue, 10 Jul 2018 21:10:12 +0200
parents 9006:935e5ca43792
children 9008:ae3c52419ec1
files plugins/muc/mod_muc.lua plugins/muc/muc.lib.lua
diffstat 2 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Tue Jul 10 00:52:46 2018 +0200
+++ b/plugins/muc/mod_muc.lua	Tue Jul 10 21:10:12 2018 +0200
@@ -156,6 +156,7 @@
 -- 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
--- a/plugins/muc/muc.lib.lua	Tue Jul 10 00:52:46 2018 +0200
+++ b/plugins/muc/muc.lib.lua	Tue Jul 10 21:10:12 2018 +0200
@@ -848,6 +848,7 @@
 	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;