Commit defcbb3e authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Check shared groups based on their display name instead of the group name. JM-463

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@3080 b35dd754-fafc-0310-a699-88a17e54d16e
parent 17262f7f
/**
* $RCSfile$
* $RCSfile: RosterItem.java,v $
* $Revision$
* $Date$
*
......@@ -322,16 +322,32 @@ public class RosterItem implements Cacheable {
}
// Remove shared groups from the param
Collection<Group> existingGroups = GroupManager.getInstance().getGroups();
for (Iterator<String> it=groups.iterator(); it.hasNext();) {
String groupName = it.next();
try {
String group = it.next();
// Optimistic approach for performance reasons. Assume first that the shared
// group name is the same as the display name for the shared roster
// Check if exists a shared group with this name
GroupManager.getInstance().getGroup(group);
// Remove the shared group from the list (since it exists)
it.remove();
Group group = GroupManager.getInstance().getGroup(groupName);
// Get the display name of the group
String displayName = group.getProperties().get("sharedRoster.displayName");
if (displayName.equals(groupName)) {
// Remove the shared group from the list (since it exists)
it.remove();
}
}
catch (GroupNotFoundException e) {
// Do nothing since the group is a personal group
// Check now if there is a group whose display name matches the requested group
for (Group group : existingGroups) {
// Get the display name of the group
String displayName = group.getProperties().get("sharedRoster.displayName");
if (displayName.equals(groupName)) {
// Remove the shared group from the list (since it exists)
it.remove();
}
}
}
}
this.groups = 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