Commit 2e083e3b authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

1) Do not pub roster items with sub status NONE and subscription pending. JM-667

2) Do not throw UserNotFoundException when updating a roster item to status NONE. JM-668

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3833 b35dd754-fafc-0310-a699-88a17e54d16e
parent c49c6702
...@@ -336,7 +336,10 @@ public class Roster implements Cacheable { ...@@ -336,7 +336,10 @@ public class Roster implements Cacheable {
public void updateRosterItem(RosterItem item) throws UserNotFoundException { public void updateRosterItem(RosterItem item) throws UserNotFoundException {
if (rosterItems.putIfAbsent(item.getJid().toBareJID(), item) == null) { if (rosterItems.putIfAbsent(item.getJid().toBareJID(), item) == null) {
rosterItems.remove(item.getJid().toBareJID()); rosterItems.remove(item.getJid().toBareJID());
throw new UserNotFoundException(item.getJid().toBareJID()); if (item.getSubStatus() != RosterItem.SUB_NONE) {
throw new UserNotFoundException(item.getJid().toBareJID());
}
return;
} }
// If the item only had shared groups before this update then make it persistent // If the item only had shared groups before this update then make it persistent
if (item.isShared() && item.getID() == 0) { if (item.isShared() && item.getID() == 0) {
...@@ -366,9 +369,11 @@ public class Roster implements Cacheable { ...@@ -366,9 +369,11 @@ public class Roster implements Cacheable {
rosterItemProvider.updateItem(username, item); rosterItemProvider.updateItem(username, item);
} }
// broadcast roster update // broadcast roster update
//if (item.getAskStatus() != RosterItem.ASK_NONE) { // Do not push items with a state of "None + Pending In"
if (item.getSubStatus() != RosterItem.SUB_NONE ||
item.getAskStatus() != RosterItem.ASK_SUBSCRIBE) {
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) {
probePresence(item.getJid()); probePresence(item.getJid());
}*/ }*/
...@@ -477,9 +482,11 @@ public class Roster implements Cacheable { ...@@ -477,9 +482,11 @@ public class Roster implements Cacheable {
" with no displayName"); " with no displayName");
} }
} }
//if (item.getAskStatus() != RosterItem.ASK_NONE) { // Do not push items with a state of "None + Pending In"
if (item.getSubStatus() != RosterItem.SUB_NONE ||
item.getAskStatus() != RosterItem.ASK_SUBSCRIBE) {
roster.addItem(item.getJid(), item.getNickname(), ask, sub, groups); roster.addItem(item.getJid(), item.getNickname(), ask, sub, groups);
//} }
} }
return roster; return roster;
} }
......
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