Hi,
im not 100% sure but i think i found a bug in Openfire 3.10.2...
When i ban a user from a MUC Room with:
<iq xmlns="jabber:client" type="set" to="x9cdypkn8f53t8jj@conference.xxx.com" id="09d4a708-2669-491f-bebe-5177a457d6b7">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item jid="5hd8l1tofha94kjo@xxx.com" affiliation="outcast">
<reason>--</reason>
</item>
</query>
</iq>
Openfire 3.9.3 replies with:
<presence xmlns="jabber:client" to="ouxmxx24w9r1vpyx@xxx.com/x9cdypkn8f53t8jj" id="eb9d23e5-db2a-4c3d-ae8e-a6699d5f5674" from="x9cdypkn8f53t8jj@conference.xxx.com/User-BGCMW" type="unavailable">
<c xmlns="http://jabber.org/protocol/caps" node="https://stanza.io" hash="sha-1" ver="4ArXvj+KpyleAhwHHCoKUPRQRto=" />
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="5hd8l1tofha94kjo@xxx.com/x9cdypkn8f53t8jj" affiliation="outcast" role="none">
<reason>--</reason>
</item>
<status code="301" />
</x>
</presence>
In Openfire 3.10.2 the sequence looks like the following:
<iq xmlns="jabber:client" type="set" to="qa69byv65me8ea0v@conference.xxx.com" id="45830125-2a20-4c6e-9d85-e705944690fc">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item jid="5hd8l1tofha94kjo@xxx.com" affiliation="outcast">
<reason>--</reason>
</item>
</query>
</iq>
reply...
<presence xmlns="jabber:client" to="ouxmxx24w9r1vpyx@xxx.com/qa69byv65me8ea0v" id="20526e1e-3b09-4186-9c2b-0cd4b74366d7" from="qa69byv65me8ea0v@conference.xxx.com/User-BGCMW" type="unavailable">
<c xmlns="http://jabber.org/protocol/caps" node="https://stanza.io" hash="sha-1" ver="4ArXvj+KpyleAhwHHCoKUPRQRto=" />
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="5hd8l1tofha94kjo@xxx.com/qa69byv65me8ea0v" affiliation="none" role="none" />
</x>
</presence>
Please note the missing affiliation in the presence and the missing status code. Additionally the user is actually not kicked immediately.
I think this is due to the following (from LocalMUCRoom.java line 1772)
if (isMembersOnly() && kickMember) {
// If the room is members-only, remove the user from the room including a status
// code of 321 to indicate that the user was removed because of an affiliation change
// a status code of 301 indicates the user was removed as an outcast
for (Presence presence : thisOccupant) {
presence.setType(Presence.Type.unavailable);
presence.setStatus(null);
Element x = presence.getChildElement("x", "http://jabber.org/protocol/muc#user");
if (reason != null && reason.trim().length() > 0) {
x.element("item").addElement("reason").setText(reason);
}
x.addElement("status").addAttribute("code", isOutcast ? "301" : "321");
kickPresence(presence, senderRole.getUserAddress());
}
}
The code actually only updates affiliation, add status code and kicks the user when the room is members only.
If i understand the muc xep correctly it should be also possible to ban users from rooms which are not members only.
Florian