HELP! About ROLES and AFFILIATIONS

Hi,

I need code example about creating role and affiliations in a MUC room. I don’'t understand MUC javadocs about this.

I make the room.

Next, i want to add, for example, a new administrator.

Next i want to add a moderator.

I don’‘t now how. Sorry but i’'m a beginner.

Thanks

Donato,

So far the only way to grant or revoke moderator and/or administrator privileges is to do it individually. This means that you will have to send a message for each user that you want to change his privileges. In a few days I’'ll add the ability to edit the list of users that have a given privilege (e.g. admin).

Having said that, you can use #grantModerator(String nickname) and #revokeModerator(String nickname) to manage moderator privileges. And to manage administrator privileges you can use #grantAdmin(String jid) and #revokeAdmin(String jid) where jid is a bare jid (e.g. "user@host.org").

Example:

// User1 creates the room
    muc = new MultiUserChat(conn1, room);
    muc.create("testbot");     // User1 sends an empty room configuration form which indicates that we want
    // an instant room
    muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));     // The room owner converts the instant room into a moderated room
    Form form = muc.getConfigurationForm();
    Form answerForm = form.createAnswerForm();
    answerForm.setAnswer("muc#owner_moderatedroom", "1");
    muc.sendConfigurationForm(answerForm);     // User2 joins the new room (as a visitor)
    MultiUserChat muc2 = new MultiUserChat(conn2, room);
    muc2.join("testbot2",SmackConfiguration.getPacketReplyTimeout(),null,0,-1,-1,null);     // The room''s owner grants moderator privileges to a visitor
    muc.grantModerator("testbot2");     // The room''s owner grants admin privileges to a user
    muc.grantAdmin("user3@host.com");

Regards,

– Gato

Message was edited by: dombiak_gaston

Thanks Gato,

I am waiting for your new release.

Go!Go!Go!