diff options
author | hristoterezov <hristo@jitsi.org> | 2013-12-14 15:18:04 +0200 |
---|---|---|
committer | hristoterezov <hristo@jitsi.org> | 2013-12-14 15:18:04 +0200 |
commit | dfac8a056e02d996eadc435450fbc83bf93b5912 (patch) | |
tree | a7718845baacea23b45d7f378b73eaea5a89a3a9 /src/net | |
parent | 79214016b4ed3342707f1b5a0d7dcd10921cec78 (diff) | |
download | jitsi-dfac8a056e02d996eadc435450fbc83bf93b5912.zip jitsi-dfac8a056e02d996eadc435450fbc83bf93b5912.tar.gz jitsi-dfac8a056e02d996eadc435450fbc83bf93b5912.tar.bz2 |
Fixes contact list issue with duplicated contacts.
Diffstat (limited to 'src/net')
3 files changed, 91 insertions, 37 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java index 64ed8b0..b30a517 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java @@ -311,20 +311,36 @@ public class PresenceFilter UIContact newUIContact;
synchronized (metaContact)
{
- newUIContact = MetaContactListSource
- .createUIContact(metaContact);
- }
+ newUIContact
+ = MetaContactListSource.getUIContact(metaContact);
- GuiActivator.getContactList().addContact(
- newUIContact,
- uiGroup,
- true,
- true);
+ if (newUIContact == null)
+ {
+ newUIContact = MetaContactListSource
+ .createUIContact(metaContact);
+
+ GuiActivator.getContactList().addContact(
+ newUIContact,
+ uiGroup,
+ true,
+ true);
+ }
+
+ }
query.setInitialResultCount(resultCount);
}
else
- query.fireQueryEvent(metaContact);
+ {
+ synchronized (metaContact)
+ {
+ if (MetaContactListSource.getUIContact(metaContact)
+ == null)
+ {
+ query.fireQueryEvent(metaContact);
+ }
+ }
+ }
}
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java index e614a4b..7da4d5e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java @@ -569,24 +569,34 @@ public class TreeContactList { MetaContactGroup rootGroup = GuiActivator.getContactListService().getRoot(); - UIGroup uiGroup = MetaContactListSource - .getUIGroup(rootGroup); + UIGroup uiGroup; + synchronized (rootGroup) + { + uiGroup = MetaContactListSource + .getUIGroup(rootGroup); - if (uiGroup != null) - return; + if (uiGroup != null) + return; - uiGroup = MetaContactListSource - .createUIGroup(rootGroup); - + uiGroup = MetaContactListSource + .createUIGroup(rootGroup); + } treeModel.getRoot().sortedAddContactGroup((UIGroupImpl)uiGroup); Iterator<MetaContact> i = rootGroup.getChildContacts(); while (i.hasNext()) { MetaContact contact = i.next(); - UIContact uiContact = MetaContactListSource.getUIContact(contact); - removeContact(uiContact); - uiContact = MetaContactListSource.createUIContact(contact); + UIContact uiContact; + synchronized (contact) + { + uiContact + = MetaContactListSource.getUIContact(contact); + if(uiContact == null) + continue; + removeContact(uiContact); + uiContact = MetaContactListSource.createUIContact(contact); + } if (currentFilter.isMatching(uiContact)) addContact(uiContact, uiGroup, true, true); else @@ -602,11 +612,15 @@ public class TreeContactList MetaContactGroup rootGroup = GuiActivator.getContactListService().getRoot(); - UIGroup uiGroup = MetaContactListSource - .getUIGroup(rootGroup); + UIGroup uiGroup; + synchronized (rootGroup) + { + uiGroup = MetaContactListSource + .getUIGroup(rootGroup); - if (uiGroup == null) - return; + if (uiGroup == null) + return; + } GroupNode parentNode = treeModel.getRoot(); @@ -614,10 +628,16 @@ public class TreeContactList while (i.hasNext()) { MetaContact contact = i.next(); - UIContact uiContact - = MetaContactListSource.getUIContact(contact); - removeContact(uiContact); - uiContact = MetaContactListSource.createUIContact(contact); + UIContact uiContact; + synchronized (contact) + { + uiContact + = MetaContactListSource.getUIContact(contact); + if(uiContact == null) + continue; + removeContact(uiContact); + uiContact = MetaContactListSource.createUIContact(contact); + } if (currentFilter.isMatching(uiContact)) addContact(uiContact, treeModel.getRoot().getGroupDescriptor(), true, true); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java index e182b3e..cdc4781 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java @@ -258,22 +258,40 @@ public class MetaContactListSource } UIContact newUIContact; + boolean uiContactCreated = false; synchronized (metaContact) { - newUIContact - = MetaContactListSource.createUIContact(metaContact); + newUIContact + = MetaContactListSource.getUIContact(metaContact); + + if (newUIContact == null) + { + newUIContact + = MetaContactListSource + .createUIContact(metaContact); + + GuiActivator.getContactList().addContact( + newUIContact, + uiGroup, + true, + true); + } + } - - GuiActivator.getContactList().addContact( - newUIContact, - uiGroup, - true, - true); - + query.setInitialResultCount(resultCount); } else - query.fireQueryEvent(metaContact); + { + synchronized (metaContact) + { + if (MetaContactListSource.getUIContact(metaContact) + == null) + { + query.fireQueryEvent(metaContact); + } + } + } } } |