Commit eb1f971e authored by Guus der Kinderen's avatar Guus der Kinderen

Merge pull request #429 from sco0ter/of317

Subscribe with Response Unsubscribed Causes Roster Push to Responding Client
parents 441cfe79 a9c43db1
......@@ -210,7 +210,7 @@ public class PresenceSubscribeHandler extends BasicModule implements ChannelHand
// Send the presence of the local user to the remote user. The remote user
// subscribed to the presence of the local user and the local user accepted
JID prober = localServer.isLocal(recipientJID) ? recipientJID.asBareJID() : recipientJID;
if (presenceManager.canProbePresence(prober, senderJID.toString())){
if (presenceManager.canProbePresence(prober, senderJID.getNode())){
presenceManager.probePresence(prober, senderJID);
PresenceEventDispatcher.subscribedToPresence(recipientJID, senderJID);
}
......
......@@ -420,7 +420,7 @@ public class Roster implements Cacheable, Externalizable {
// broadcast roster update
// Do not push items with a state of "None + Pending In"
if (item.getSubStatus() != RosterItem.SUB_NONE ||
item.getRecvStatus() != RosterItem.RECV_SUBSCRIBE) {
item.getRecvStatus() != RosterItem.RECV_SUBSCRIBE && !isSubscriptionRejected(item)) {
broadcast(item, true);
}
/*if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_TO) {
......@@ -430,6 +430,18 @@ public class Roster implements Cacheable, Externalizable {
RosterEventDispatcher.contactUpdated(this, item);
}
/**
* Returns true if roster item represents a rejected subscription request.
*
* @param item The roster item.
* @return True, if the roster item represents a rejected subscription request.
*/
private static boolean isSubscriptionRejected(RosterItem item) {
return item.getSubStatus() == RosterItem.SUB_NONE &&
item.getRecvStatus() == RosterItem.RECV_NONE &&
item.getAskStatus() == RosterItem.AskType.NONE;
}
/**
* Remove a user from the roster.
*
......@@ -553,7 +565,7 @@ public class Roster implements Cacheable, Externalizable {
}
// Do not push items with a state of "None + Pending In"
if (item.getSubStatus() != RosterItem.SUB_NONE ||
item.getRecvStatus() != RosterItem.RECV_SUBSCRIBE) {
item.getRecvStatus() != RosterItem.RECV_SUBSCRIBE && !isSubscriptionRejected(item)) {
roster.addItem(item.getJid(), item.getNickname(), ask, sub, groups);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment