Project

General

Profile

Modifying the member list issue

Igor Khomenko
Added about 4 years ago

I read a topic about Modifying the Member List http://xmpp.org/extensions/xep-0045.html#modifymember

Here are next sentences:

each item MUST include the 'affiliation' attribute (normally set to a value of "member" or "none")
The service MUST change the affiliation of any affected user. If the user has been removed from the member list, the service MUST change the user's affiliation from "member" to "none". If the user has been added to the member list, the service MUST change the user's affiliation to "member".

If a removed member is currently in a members-only room, the service SHOULD kick the occupant by changing the removed member's role to "none" and send appropriate presence to the removed member as previously described. The service MUST subsequently refuse entry to the user.

I quickly tried to set an affiliation to none but looks Tigase doesn't kick a user.

Then I checked the src code, ModeratorModule.processSetAffiliation method and here is a code which kicks a user:

if (newAffiliation == Affiliation.outcast) {
    codes.add("301");
    isUnavailable = true;

    final Collection<JID> occupantJids = room.getOccupantsJidsByNickname(occupantNick);

    for (JID jid : occupantJids) {
        Packet occupantKickPresence = makePresence(jid, room.getRoomJID(), room, occupantBareJid, isUnavailable,
        newAffiliation, newRole, occupantNick, reason, actor, codes.toArray(new String[] {}));

        writer.write(occupantKickPresence);
    }
    room.removeOccupant(occupantNick);
    ghostbuster.remove(occupantJids, room);
}

It compares only for Affiliation.outcast but not for Affiliation.none

Maybe it's better to use something like this:

if (newAffiliation == Affiliation.outcast || if (newAffiliation == Affiliation.none) {) {

Could you please comment


Replies (2)

Avatar?id=6098&size=32x32

Added by Bartosz Małkowski TigaseTeam about 4 years ago

Fix commited.

Added by Igor Khomenko about 4 years ago

That's great, thanks!

    (1-2/2)