Commit 72932303 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Many bug fixes for shared groups. JM-148


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@983 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0a61c072
...@@ -125,6 +125,7 @@ public class RosterItem implements Cacheable { ...@@ -125,6 +125,7 @@ public class RosterItem implements Cacheable {
protected String nickname; protected String nickname;
protected List<String> groups; protected List<String> groups;
protected Set<String> sharedGroups = new HashSet<String>(); protected Set<String> sharedGroups = new HashSet<String>();
protected Set<String> invisibleSharedGroups = new HashSet<String>();
protected SubType subStatus; protected SubType subStatus;
protected AskType askStatus; protected AskType askStatus;
private long rosterID; private long rosterID;
...@@ -343,6 +344,17 @@ public class RosterItem implements Cacheable { ...@@ -343,6 +344,17 @@ public class RosterItem implements Cacheable {
return sharedGroups; return sharedGroups;
} }
/**
* Returns the invisible shared groups for the item. These groups are for internal use
* and help track the reason why a roster item has a presence subscription of type FROM
* when using shared groups.
*
* @return The shared groups this item belongs to.
*/
public Collection<String> getInvisibleSharedGroups() {
return invisibleSharedGroups;
}
/** /**
* Adds a new group to the shared groups list. * Adds a new group to the shared groups list.
* *
...@@ -350,6 +362,18 @@ public class RosterItem implements Cacheable { ...@@ -350,6 +362,18 @@ public class RosterItem implements Cacheable {
*/ */
public void addSharedGroup(String sharedGroup) { public void addSharedGroup(String sharedGroup) {
sharedGroups.add(sharedGroup); sharedGroups.add(sharedGroup);
invisibleSharedGroups.remove(sharedGroup);
}
/**
* Adds a new group to the list shared groups that won't be sent to the user. These groups
* are for internal use and help track the reason why a roster item has a presence
* subscription of type FROM when using shared groups.
*
* @param sharedGroup The shared group to add to the list of shared groups.
*/
public void addInvisibleSharedGroup(String sharedGroup) {
invisibleSharedGroups.add(sharedGroup);
} }
/** /**
...@@ -359,6 +383,7 @@ public class RosterItem implements Cacheable { ...@@ -359,6 +383,7 @@ public class RosterItem implements Cacheable {
*/ */
public void removeSharedGroup(String sharedGroup) { public void removeSharedGroup(String sharedGroup) {
sharedGroups.remove(sharedGroup); sharedGroups.remove(sharedGroup);
invisibleSharedGroups.remove(sharedGroup);
} }
/** /**
...@@ -368,7 +393,7 @@ public class RosterItem implements Cacheable { ...@@ -368,7 +393,7 @@ public class RosterItem implements Cacheable {
* @return true if this item belongs to a shared group. * @return true if this item belongs to a shared group.
*/ */
public boolean isShared() { public boolean isShared() {
return !sharedGroups.isEmpty(); return !sharedGroups.isEmpty() || !invisibleSharedGroups.isEmpty();
} }
/** /**
...@@ -379,7 +404,7 @@ public class RosterItem implements Cacheable { ...@@ -379,7 +404,7 @@ public class RosterItem implements Cacheable {
* @return true if this item belongs ONLY to shared groups. * @return true if this item belongs ONLY to shared groups.
*/ */
public boolean isOnlyShared() { public boolean isOnlyShared() {
return !sharedGroups.isEmpty() && groups.isEmpty(); return isShared() && groups.isEmpty();
} }
/** /**
......
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