#887 muc-room-destroyed event is firing multiple times when room is explicitly destroyed
Reporter
Lance Stout
Owner
Zash
Created
Updated
Stars
★ (1)
Tags
Priority-Medium
Status-Fixed
Type-Defect
Milestone-0.11
Lance Stout
on
What steps will reproduce the problem?
1. Using Prosody trunk, create a non-persistent MUC room
2. Have several users join the room
3. Explicitly send a room destroy command
What is the expected output? What do you see instead?
Expected result is that the `muc-room-destroyed` event will fire once. Instead it fires for every occupant in the room.
What version of the product are you using? On what operating system?
Prosody trunk (for new muc), Debian
Please provide any additional information below.
Looks to be caused by how these two handlers are interacting:
https://hg.prosody.im/trunk/file/tip/plugins/muc/muc.lib.lua#l811https://hg.prosody.im/trunk/file/tip/plugins/muc/mod_muc.lua#l123
The clear() method in muc.lib is emptying out the room occupants, and afterward triggering a muc-occupant-left event for each occupant.
This muc-occupant-left handler in mod_muc is checking if the room is now empty, and firing muc-room-destroyed if so. Except that we just cleared out all of the occupants, so the room appears empty to all of the previous occupants.
What steps will reproduce the problem? 1. Using Prosody trunk, create a non-persistent MUC room 2. Have several users join the room 3. Explicitly send a room destroy command What is the expected output? What do you see instead? Expected result is that the `muc-room-destroyed` event will fire once. Instead it fires for every occupant in the room. What version of the product are you using? On what operating system? Prosody trunk (for new muc), Debian Please provide any additional information below. Looks to be caused by how these two handlers are interacting: https://hg.prosody.im/trunk/file/tip/plugins/muc/muc.lib.lua#l811 https://hg.prosody.im/trunk/file/tip/plugins/muc/mod_muc.lua#l123 The clear() method in muc.lib is emptying out the room occupants, and afterward triggering a muc-occupant-left event for each occupant. This muc-occupant-left handler in mod_muc is checking if the room is now empty, and firing muc-room-destroyed if so. Except that we just cleared out all of the occupants, so the room appears empty to all of the previous occupants.
Fixed in https://hg.prosody.im/trunk/rev/695904638cfa Thanks for the report. I stumbled upon this due to #1182
Changes