powered by Jive Software

MUC changeRole in specified channel

Situation:

My bot is joined in two channels (room A, room B).

It has a moderator status in room B.

When I join (with another client) room A (where I can speak) and room B (where i need to be voiced),

I tell my bot (in room A) to grantVoice me for room B.

Code on bot:

muc.grantVoice(username);

The bot will ALWAYS send this command to the room witch was set in the constructor of the muc. Even if the muc is joind in multiple rooms.

There is no way I can tell smack the room I would like to exucute this command.

Smack Code:

public MultiUserChat(XMPPConnection connection, String room) {

this.room = room.toLowerCase();

}

public void grantVoice(String nickname) throws XMPPException {
changeRole(nickname, “participant”, null);
}

private void changeRole(Collection nicknames, String role) throws XMPPException {

** iq.setTo(room);**

}

I tried to use the hole username roomB@server/clientname but that doesn’t work either.

I think this can be solved easly by creating a method like this.

muc.grantVoice(username, room);

public void grantVoice(String nickname, String room) throws XMPPException {
changeRole(nickname, “participant”, **room **, null);
}

private void changeRole(Collection nicknames,String room, String role) throws XMPPException {

** iq.setTo(room);**

}