diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2010-12-21 09:35:36 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2010-12-21 09:35:36 +0000 |
commit | 2938c560b8d9c0369c4fc244adf11cb8f0e423e7 (patch) | |
tree | bef6fc6c9060886b64573ff4325887bae6c4a96a | |
parent | 075d383ec025133f3289504f6bfd63291be0a8b1 (diff) | |
download | jitsi-2938c560b8d9c0369c4fc244adf11cb8f0e423e7.zip jitsi-2938c560b8d9c0369c4fc244adf11cb8f0e423e7.tar.gz jitsi-2938c560b8d9c0369c4fc244adf11cb8f0e423e7.tar.bz2 |
Commits work in progress on adding support for the Address Book of Microsoft Outlook. (Should have been a part of r8093.)
-rw-r--r-- | src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java | 116 |
1 files changed, 18 insertions, 98 deletions
diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java index ac03042..a774fd5 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java @@ -35,6 +35,17 @@ public class CallHistoryContactSource implements ContactSourceService } /** + * Returns the identifier of this contact source. Some of the common + * identifiers are defined here (For example the CALL_HISTORY identifier + * should be returned by all call history implementations of this interface) + * @return the identifier of this contact source + */ + public String getIdentifier() + { + return CALL_HISTORY; + } + + /** * Queries this contact source for the given <tt>searchString</tt>. * @param queryString the string to search for * @return the created query @@ -56,15 +67,9 @@ public class CallHistoryContactSource implements ContactSourceService * query to the contact source. */ private class CallHistoryContactQuery - implements ContactQuery + extends AbstractContactQuery<CallHistoryContactSource> { /** - * A list of all registered query listeners. - */ - private final List<ContactQueryListener> queryListeners - = new LinkedList<ContactQueryListener>(); - - /** * A list of all source contact results. */ private final List<SourceContact> sourceContacts @@ -90,6 +95,8 @@ public class CallHistoryContactSource implements ContactSourceService */ public CallHistoryContactQuery(Collection<CallRecord> callRecords) { + super(CallHistoryContactSource.this); + Iterator<CallRecord> recordsIter = callRecords.iterator(); while (recordsIter.hasNext() && status != QUERY_CANCELED) @@ -111,6 +118,8 @@ public class CallHistoryContactSource implements ContactSourceService */ public CallHistoryContactQuery(CallHistoryQuery callHistoryQuery) { + super(CallHistoryContactSource.this); + this.callHistoryQuery = callHistoryQuery; callHistoryQuery.addQueryListener(new CallHistoryQueryListener() @@ -121,32 +130,19 @@ public class CallHistoryContactSource implements ContactSourceService CallHistoryContactSource.this, event.getCallRecord()); sourceContacts.add(contact); - fireQueryEvent(contact); + fireContactReceived(contact); } public void queryStatusChanged( CallHistoryQueryStatusEvent event) { status = event.getEventType(); - fireQueryStatusEvent(status); + fireQueryStatusChanged(status); } }); } /** - * Adds the given <tt>ContactQueryListener</tt> to the list of query - * listeners. - * @param l the <tt>ContactQueryListener</tt> to add - */ - public void addContactQueryListener(ContactQueryListener l) - { - synchronized (queryListeners) - { - queryListeners.add(l); - } - } - - /** * This query could not be canceled. */ public void cancel() @@ -168,19 +164,6 @@ public class CallHistoryContactSource implements ContactSourceService } /** - * Removes the given <tt>ContactQueryListener</tt> from the list of - * query listeners. - * @param l the <tt>ContactQueryListener</tt> to remove - */ - public void removeContactQueryListener(ContactQueryListener l) - { - synchronized (queryListeners) - { - queryListeners.remove(l); - } - } - - /** * Returns a list containing the results of this query. * @return a list containing the results of this query */ @@ -188,68 +171,5 @@ public class CallHistoryContactSource implements ContactSourceService { return sourceContacts; } - - /** - * Returns the <tt>ContactSourceService</tt>, where this query was first - * initiated. - * @return the <tt>ContactSourceService</tt>, where this query was first - * initiated - */ - public ContactSourceService getContactSource() - { - return CallHistoryContactSource.this; - } - - /** - * Notifies all registered <tt>ContactQueryListener</tt>s that a new - * contact has been received. - * @param contact the <tt>SourceContact</tt> this event is about - */ - private void fireQueryEvent(SourceContact contact) - { - ContactReceivedEvent event = new ContactReceivedEvent(this, contact); - - Collection<ContactQueryListener> listeners; - synchronized (queryListeners) - { - listeners - = new ArrayList<ContactQueryListener>(queryListeners); - } - - for (ContactQueryListener l : listeners) - l.contactReceived(event); - } - - /** - * Notifies all registered <tt>ContactQueryListener</tt>s that a new - * record has been received. - * @param newStatus the new status - */ - private void fireQueryStatusEvent(int newStatus) - { - ContactQueryStatusEvent event - = new ContactQueryStatusEvent(this, newStatus); - - Collection<ContactQueryListener> listeners; - synchronized (queryListeners) - { - listeners - = new ArrayList<ContactQueryListener>(queryListeners); - } - - for (ContactQueryListener l : listeners) - l.queryStatusChanged(event); - } - } - - /** - * Returns the identifier of this contact source. Some of the common - * identifiers are defined here (For example the CALL_HISTORY identifier - * should be returned by all call history implementations of this interface) - * @return the identifier of this contact source - */ - public String getIdentifier() - { - return CALL_HISTORY; } } |