summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/isode/stroke/muc/MUCImpl.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/isode/stroke/muc/MUCImpl.java b/src/com/isode/stroke/muc/MUCImpl.java
index 26be309..2a45926 100644
--- a/src/com/isode/stroke/muc/MUCImpl.java
+++ b/src/com/isode/stroke/muc/MUCImpl.java
@@ -74,79 +74,83 @@ public class MUCImpl extends MUC {
public MUCImpl(StanzaChannel stanzaChannel, IQRouter iqRouter,
DirectedPresenceSender presenceSender, final JID muc,
MUCRegistry mucRegistry) {
ownMUCJID = muc;
this.stanzaChannel = stanzaChannel;
this.iqRouter_ = iqRouter;
this.presenceSender = presenceSender;
this.mucRegistry = mucRegistry;
this.createAsReservedIfNew = false;
this.unlocking = false;
this.isUnlocked_ = false;
scopedConnection_ = this.stanzaChannel.onPresenceReceived.connect(
new Slot1<Presence>() {
@Override
public void call(Presence p1) {
handleIncomingPresence(p1);
}
});
}
/**
* Cancel the command for configuring room
*/
@Override
public void cancelConfigureRoom() {
MUCOwnerPayload mucPayload = new MUCOwnerPayload();
mucPayload.setPayload(new Form(Form.Type.CANCEL_TYPE));
GenericRequest<MUCOwnerPayload> request = new GenericRequest<MUCOwnerPayload>(
IQ.Type.Set, getJID(), mucPayload, iqRouter_);
request.send();
}
/**
* Change the affiliation of the given Jabber ID.
* It must be called with the real JID, not the room JID.
- * @param jid real jabber ID, not null
+ * @param jid real jabber ID, not null. NOTE: This method does not
+ strip any resource from the JID, as expected by XEP-0045. Callers
+ wanting to be strictly XEP-0045 conformant should pass in a bare JID
* @param affiliation new affiliation, not null
*/
@Override
public void changeAffiliation(final JID jid, final MUCOccupant.Affiliation affiliation) {
final MUCAdminPayload mucPayload = new MUCAdminPayload();
MUCItem item = new MUCItem();
item.affiliation = affiliation;
- item.realJID = jid.toBare();
+ // According to XEP-0045 the JID should be bare, but this isn't being done here because
+ // to provide support for applications where we do want to set affilations on a per resource basis
+ item.realJID = jid;
mucPayload.addItem(item);
GenericRequest<MUCAdminPayload> request = new GenericRequest<MUCAdminPayload>(
IQ.Type.Set, getJID(), mucPayload, iqRouter_);
request.onResponse.connect(new Slot2<MUCAdminPayload, ErrorPayload>() {
@Override
public void call(MUCAdminPayload p1, ErrorPayload p2) {
handleAffiliationChangeResponse(p1,p2,jid,affiliation);
}
});
request.send();
}
/**
* Change the role of the specified occupant. It must be
* called with the room JID, not the real JID.
* @param jid Jabber ID of the occupant in the chat room, not null
* @param role new role, not null
*/
@Override
public void changeOccupantRole(final JID jid, final MUCOccupant.Role role) {
final MUCAdminPayload mucPayload = new MUCAdminPayload();
MUCItem item = new MUCItem();
item.role = role;
item.nick = jid.getResource();
mucPayload.addItem(item);
GenericRequest<MUCAdminPayload> request = new GenericRequest<MUCAdminPayload>(
IQ.Type.Set, getJID(), mucPayload, iqRouter_);
request.onResponse.connect(new Slot2<MUCAdminPayload, ErrorPayload>() {
@Override
public void call(MUCAdminPayload p1, ErrorPayload p2) {
handleOccupantRoleChangeResponse(p1,p2,jid,role);
}
});
request.send();
}