MUC affiliation changes not broadcasted to clients

Discussion created by Mike on Aug 20, 2016
Latest reply on Aug 20, 2016 by Mike

When a user's affiliation changes in a MUC room (e.g. from none to moderator) and that user is currently in the room, its affiliation change is not being broadcasted to the room occupants. While the new affiliation is correctly applied (he has the powers of the new affiliation level like kicking users etc.), clients are not informed by the server about the change.


Usually, clients will indiacte a user's affiliation with different icons for owners, moderators, members and visitors. If affiliation changes are not broadcasted, clients won't update their display and might even prevent administrative commands in their UI if they think the user isn't allowed that command at his apparent affiliation level.

If the user leaves and rejoins the MUC room, the correct affiliation is broadcasted.


This happens with affiliation changes triggered from the Admin GUI and the REST API, so I assume it happens regardless of what triggers the affiliation change. When looking into this issue, please make sure a fix would be applied centrally so that it applies regardless of what triggered the affiliation change.


** Edit: The XEP-0045: Multi-User Chat says in "5.2.2 Changing Affiliations":

Sometimes the change results from the user's own action (e.g., registering as a member of the room), whereas sometimes the change results from an action taken by an admin or owner. If a user's affiliation changes, a MUC service implementation MUST change the user's affiliation to reflect the change and communicate that to all occupants (if the room is configured to broadcast presence from entities with a given role).


** Edit2: I think I found the bug. I tested with Adium (libpurple) and Psi on Mac. Both do not update the user affiliation if I change it in the Openfire Admin Console. I see a packet from the Server in the client's XML Console though. This packet always contains the affiliation the user had when he joined the channel, NOT the new one! Here, I just removed the user's owner affiliation and this is what Openfire broadcasts:

<presence from="channel@conference.server/targetUser" to="observingUser@server/observingResource">

<c xmlns="http://jabber.org/protocol/caps" node="http://pidgin.im/" ver="DdnydQG7RGhP9E3k9Sf+b+bF0zo=" hash="sha-1"/>

<x xmlns="http://jabber.org/protocol/muc#user">

<item affiliation="owner" role="moderator"/>