I’ve been doing some work on the Openfire MUC component, and this patch fixes a few various issues including:
It also sends the room topic to users upon joining the room as outlined in this thread:
The final problem it resolves is this: Currently when you uncheck the “broadcast presence for” for a certain role (say visitor), their join presence is correctly supressed, but their unavailable presence is not when they leave the room. This is because Openfire (correctly) sets their role to none upon departure.
Unfortunately this is done right before the check to see if their presence should be broadcast, resulting in the presence always being sent to the entire room, despite them previously being a visitor.
To solve this, I created a shouldBroadcastPresence function, and check to see if the user’s original presence should be broadcast. If not, the new presence (with role=none) is only sent to the user, and not the entire room. This also fixes the issue listed above where unavailable presence packets were being sent twice upon user departure.
If someone would like to review and possibly integrate this patch, that would be excellent: