diff options
author | Yana Stamcheva <yana@jitsi.org> | 2013-04-11 16:56:05 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2013-04-11 16:56:05 +0000 |
commit | ffa2f58f8415230ffe630e01ec15fe0b0219b0d1 (patch) | |
tree | 2e192d2f83b1da54cef74670f670848444dc3f21 /src/net/java/sip/communicator/plugin/demuxcontactsource | |
parent | 7e93dbb052266f5f0a4cbd204ed42eb012fdfe6a (diff) | |
download | jitsi-ffa2f58f8415230ffe630e01ec15fe0b0219b0d1.zip jitsi-ffa2f58f8415230ffe630e01ec15fe0b0219b0d1.tar.gz jitsi-ffa2f58f8415230ffe630e01ec15fe0b0219b0d1.tar.bz2 |
Fixes telephone contacts order in all confernece and transfer invite windows.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/demuxcontactsource')
-rw-r--r-- | src/net/java/sip/communicator/plugin/demuxcontactsource/DemuxContactSource.java | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/src/net/java/sip/communicator/plugin/demuxcontactsource/DemuxContactSource.java b/src/net/java/sip/communicator/plugin/demuxcontactsource/DemuxContactSource.java index 88c7cff..d9bcf3e 100644 --- a/src/net/java/sip/communicator/plugin/demuxcontactsource/DemuxContactSource.java +++ b/src/net/java/sip/communicator/plugin/demuxcontactsource/DemuxContactSource.java @@ -143,6 +143,9 @@ public class DemuxContactSource */ private final ContactQuery sourceQuery; + private TreeSet<SourceContact> demuxContacts + = new TreeSet<SourceContact>(); + /** * Creates an instance of <tt>DemuxContactQuery</tt>. * @@ -154,6 +157,8 @@ public class DemuxContactSource this.sourceQuery = sourceQuery; + initQueryResults(); + sourceQuery.addContactQueryListener(this); } @@ -181,19 +186,14 @@ public class DemuxContactSource } /** - * Returns the list of <tt>SourceContact</tt>s returned by this query. - * - * @return the list of <tt>SourceContact</tt>s returned by this query + * Initializes the query results. */ - public List<SourceContact> getQueryResults() + public void initQueryResults() { List<SourceContact> sourceContacts = sourceQuery.getQueryResults(); if (sourceContacts == null) - return null; - - List<SourceContact> newSourceContacts - = new ArrayList<SourceContact>(); + return; Iterator<SourceContact> contactIter = sourceContacts.iterator(); while (contactIter.hasNext()) @@ -210,14 +210,25 @@ public class DemuxContactSource if (preferredProtocolProviders == null || isPreferredContactDetail(detail)) { - newSourceContacts.add( - createSourceContact(sourceContact, - detail)); + SortedGenericSourceContact + demuxContact + = (SortedGenericSourceContact) + createSourceContact(sourceContact, + detail); + demuxContacts.add(demuxContact); } } } + } - return newSourceContacts; + /** + * Returns the list of <tt>SourceContact</tt>s returned by this query. + * + * @return the list of <tt>SourceContact</tt>s returned by this query + */ + public List<SourceContact> getQueryResults() + { + return new LinkedList<SourceContact>(demuxContacts); } public void cancel() @@ -256,8 +267,12 @@ public class DemuxContactSource if (preferredProtocolProviders == null || isPreferredContactDetail(detail)) { - fireContactReceived( - createSourceContact(sourceContact, detail)); + SourceContact demuxContact + = createSourceContact(sourceContact, detail); + + demuxContacts.add(demuxContact); + + fireContactReceived(demuxContact); } } } @@ -277,10 +292,22 @@ public class DemuxContactSource contactDetails.add(contactDetail); - GenericSourceContact genericContact - = new GenericSourceContact( DemuxContactSource.this, - sourceContact.getDisplayName(), - contactDetails); + GenericSourceContact genericContact; + + if (sourceContact instanceof SortedGenericSourceContact) + { + genericContact + = new SortedGenericSourceContact( + this, + DemuxContactSource.this, + sourceContact.getDisplayName(), + contactDetails); + } + else + genericContact + = new GenericSourceContact( DemuxContactSource.this, + sourceContact.getDisplayName(), + contactDetails); genericContact.setDisplayDetails(contactDetail.getDetail()); genericContact.setPresenceStatus(sourceContact.getPresenceStatus()); |