#887 muc-room-destroyed event is firing multiple times when room is explicitly destroyed
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:
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.