Prevent duplication of contacts after reconnect.
Add a method to recursively update the presence of contact list items (in groups, subgroups and so on).
Replace building of "Initial contact list" with it's updating after recconnect .
@@ -626,6 +626,20 @@ public class ContactList extends JPanel implements ActionListener,
}
+ private void updateContactList(ContactGroup group) throws Exception {
+ if (group != null) {
+ for (ContactItem item : group.getContactItems()) {
+ updateUserPresence(PresenceManager.getPresence(item.getJid()));
+ }
+ }
+
+ Collection<ContactGroup> subGroups = group != null ? group.getContactGroups() : this.getContactGroups();
+
+ for (ContactGroup subGroup : subGroups) {
+ updateContactList(subGroup);
+ }
+ }
+
/**
* Called when NEW entries are added.
*
@@ -2334,7 +2348,13 @@ public class ContactList extends JPanel implements ActionListener,
}
offlineGroup.fireContactGroupUpdated();
- buildContactList();
+
+ try {
+ updateContactList(null);
+ }
+ catch (Exception e) {
+ Log.error(e);
+ }
final Presence myPresence = SparkManager.getWorkspace().getStatusBar()
.getPresence();
