Commit a9c43db1 authored by Christian Schudt's avatar Christian Schudt

OF-317 Subscribe with Response Unsubscribed Causes Roster Push to Responding Client

parent 02cf1379
...@@ -420,7 +420,7 @@ public class Roster implements Cacheable, Externalizable { ...@@ -420,7 +420,7 @@ public class Roster implements Cacheable, Externalizable {
// broadcast roster update // broadcast roster update
// Do not push items with a state of "None + Pending In" // Do not push items with a state of "None + Pending In"
if (item.getSubStatus() != RosterItem.SUB_NONE || if (item.getSubStatus() != RosterItem.SUB_NONE ||
item.getRecvStatus() != RosterItem.RECV_SUBSCRIBE) { item.getRecvStatus() != RosterItem.RECV_SUBSCRIBE && !isSubscriptionRejected(item)) {
broadcast(item, true); broadcast(item, true);
} }
/*if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_TO) { /*if (item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_TO) {
...@@ -430,6 +430,18 @@ public class Roster implements Cacheable, Externalizable { ...@@ -430,6 +430,18 @@ public class Roster implements Cacheable, Externalizable {
RosterEventDispatcher.contactUpdated(this, item); 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. * Remove a user from the roster.
* *
...@@ -553,7 +565,7 @@ public class Roster implements Cacheable, Externalizable { ...@@ -553,7 +565,7 @@ public class Roster implements Cacheable, Externalizable {
} }
// Do not push items with a state of "None + Pending In" // Do not push items with a state of "None + Pending In"
if (item.getSubStatus() != RosterItem.SUB_NONE || 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); 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