Issue #3070 fixed contact request logic when adding to group

Former-commit-id: 5f746c9c56 [formerly 17ab4f6184] [formerly 5f746c9c56 [formerly 17ab4f6184] [formerly f1213c1bda [formerly 57120491452b36bf15227bd4b6d0236221c71124]]]
Former-commit-id: f1213c1bda
Former-commit-id: ed2d66a6fa [formerly fe6af8c315]
Former-commit-id: edaaa9a426
This commit is contained in:
Brian Clements 2014-04-25 13:40:52 -05:00
parent e0f4544f94
commit eb318a9a0d

View file

@ -78,6 +78,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationC
* added getSharedDisplayEnabledResource()
* Apr 24, 2014 3070 bclement added checks for empty groups, added isContact(),
* added sendContactRequest()
* fixed contact request logic in addToGroup()
*
* </pre>
*
@ -201,24 +202,14 @@ public class ContactsManager {
if (group == null) {
group = createGroup(groupName);
}
String id = user.getNormalizedId();
RosterEntry entry = group.getEntry(id);
if (entry != null) {
if (isBlocked(entry)) {
// entry is in roster, but we aren't subscribed. Request a
// subscription.
try {
connection.getAccountManager().sendPresence(user,
new Presence(Type.subscribe));
} catch (CollaborationException e) {
statusHandler.error("Problem subscribing to user", e);
}
} else {
statusHandler
.debug("Attempted to add user to group it was already in: "
+ id + " in " + groupName);
RosterEntry entry = getRosterEntry(user);
if (entry != null && isBlocked(entry)) {
/* entry is in roster, but we are blocked */
try {
sendContactRequest(user);
} catch (CollaborationException e) {
statusHandler.error("Problem subscribing to user", e);
}
return;
}
try {
addToGroup(group, user);
@ -227,8 +218,8 @@ public class ContactsManager {
}
} catch (XMPPException e) {
String msg = getGroupModInfo(e);
statusHandler.error("Problem adding user to group: " + id + " to "
+ group.getName() + ". " + msg, e);
statusHandler.error("Problem adding user to group: " + user
+ " to " + group.getName() + ". " + msg, e);
}
}