Ok, I’'m destined to make the next release of JBother have MUC support… and I have some, what are probably, dumb questions.
How do I find out what affiliations/roles a user has when I join? I know that you can add a ParticipantStatusListener to the MultiUserChat instance, but I don’‘t get anything when I connect, just when an affiliation or role is changed after I’'m already connected.
The ParticipantStatusListener interface defines a method
public void nicknameChanged(String nickname)
which you can use. You still have to do a bit of work in your psence listener class to get the full picture.
Personally, when recieve a presence for someone not already in the room, I just display a “has entered room” message. When someone changes their nick, I get something like this:
Fred has changed their nickname.
newfred has entered the room.
According to the docs on the MultiUserChat#changenickname method:
Changes the participant’'s nickname to a new nickname within the room. Each room participant will receive two presence packets. One of type “unavailable” for the old nickname and one indicating availability for the new nickname. The unavailable presence will contain the new nickname and an appropriate status code (namely 303) as extended presence information. The status code 303 indicates that the participant is changing his/her nickname.
/quote
One should be able to use this information in the presence listnening class.
You can ban a user giving a reason (see MultiUserChat#banUser(String, String)) or you can ban a list of users which is useful when doing batch changes (see MultiUserChat#banUsers(Collection)).
To remove the ban of a user you will need to change the affiliation to owner, admin or member. As with banning you can change the affiliation of a given user or of a list of users.