mirror of https://github.com/sipwise/jitsi.git
parent
c3cdd80b03
commit
362d8bc446
Binary file not shown.
Binary file not shown.
@ -0,0 +1,10 @@
|
||||
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPI_H_
|
||||
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPI_H_
|
||||
|
||||
#ifndef __in_opt
|
||||
#define __in_opt
|
||||
#endif /* #ifndef __in_opt */
|
||||
#include <mapitags.h>
|
||||
#include <mapix.h>
|
||||
|
||||
#endif /* #ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPI_H_ */
|
||||
@ -0,0 +1,19 @@
|
||||
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
|
||||
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
|
||||
|
||||
#include <jni.h>
|
||||
#include "MsOutlookMAPI.h"
|
||||
#include <tchar.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* #ifdef __cplusplus */
|
||||
|
||||
void MsOutlookMAPIHResultException_throwNew
|
||||
(JNIEnv *jniEnv, HRESULT hResult, LPCTSTR file, ULONG line);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* #ifdef __cplusplus */
|
||||
|
||||
#endif /* _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_ */
|
||||
@ -0,0 +1,29 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery */
|
||||
|
||||
#ifndef _Included_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery
|
||||
#define _Included_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery
|
||||
* Method: foreachMailUser
|
||||
* Signature: (Ljava/lang/String;Lnet/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookCallback;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_foreachMailUser
|
||||
(JNIEnv *, jclass, jstring, jobject);
|
||||
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery
|
||||
* Method: IMAPIProp_GetProps
|
||||
* Signature: (J[JJ)[Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_IMAPIProp_1GetProps
|
||||
(JNIEnv *, jclass, jlong, jlongArray, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,29 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService */
|
||||
|
||||
#ifndef _Included_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService
|
||||
#define _Included_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService
|
||||
* Method: MAPIInitialize
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIInitialize
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService
|
||||
* Method: MAPIUninitialize
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIUninitialize
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,10 +0,0 @@
|
||||
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_MSOUTLOOK_MSOUTLOOKMAPI_H_
|
||||
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_MSOUTLOOK_MSOUTLOOKMAPI_H_
|
||||
|
||||
#ifndef __in_opt
|
||||
#define __in_opt
|
||||
#endif /* #ifndef __in_opt */
|
||||
#include <mapitags.h>
|
||||
#include <mapix.h>
|
||||
|
||||
#endif /* #ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_MSOUTLOOK_MSOUTLOOKMAPI_H_ */
|
||||
@ -1,19 +0,0 @@
|
||||
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
|
||||
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
|
||||
|
||||
#include <jni.h>
|
||||
#include "MsOutlookMAPI.h"
|
||||
#include <tchar.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* #ifdef __cplusplus */
|
||||
|
||||
void MsOutlookMAPIHResultException_throwNew
|
||||
(JNIEnv *jniEnv, HRESULT hResult, LPCTSTR file, ULONG line);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* #ifdef __cplusplus */
|
||||
|
||||
#endif /* _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_ */
|
||||
@ -1,29 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery */
|
||||
|
||||
#ifndef _Included_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery
|
||||
#define _Included_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery
|
||||
* Method: foreachMailUser
|
||||
* Signature: (Ljava/lang/String;Lnet/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookCallback;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery_foreachMailUser
|
||||
(JNIEnv *, jclass, jstring, jobject);
|
||||
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery
|
||||
* Method: IMAPIProp_GetProps
|
||||
* Signature: (J[JJ)[Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery_IMAPIProp_1GetProps
|
||||
(JNIEnv *, jclass, jlong, jlongArray, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -1,29 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService */
|
||||
|
||||
#ifndef _Included_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService
|
||||
#define _Included_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService
|
||||
* Method: MAPIInitialize
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService_MAPIInitialize
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService
|
||||
* Method: MAPIUninitialize
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService_MAPIUninitialize
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.addrbook;
|
||||
|
||||
import net.java.sip.communicator.service.contactsource.*;
|
||||
import net.java.sip.communicator.util.*;
|
||||
|
||||
import org.osgi.framework.*;
|
||||
|
||||
/**
|
||||
* Implements <tt>BundleActivator</tt> for the addrbook plug-in which provides
|
||||
* support for OS-specific Address Book.
|
||||
*
|
||||
* @author Lyubomir Marinov
|
||||
*/
|
||||
public class AddrBookActivator
|
||||
implements BundleActivator
|
||||
{
|
||||
/**
|
||||
* The <tt>ContactSourceService</tt> implementation for the OS-specific
|
||||
* Address Book.
|
||||
*/
|
||||
private ContactSourceService css;
|
||||
|
||||
/**
|
||||
* The <tt>ServiceRegistration</tt> of {@link #css} in the
|
||||
* <tt>BundleContext</tt> in which this <tt>AddrBookActivator</tt> has been
|
||||
* started.
|
||||
*/
|
||||
private ServiceRegistration cssServiceRegistration;
|
||||
|
||||
/**
|
||||
* Starts the addrbook plug-in.
|
||||
*
|
||||
* @param bundleContext the <tt>BundleContext</tt> in which the addrbook
|
||||
* plug-in is to be started
|
||||
* @throws Exception if anything goes wrong while starting the addrbook
|
||||
* plug-in
|
||||
* @see BundleActivator#start(BundleContext)
|
||||
*/
|
||||
public void start(BundleContext bundleContext)
|
||||
throws Exception
|
||||
{
|
||||
String cssClassName;
|
||||
|
||||
if (OSUtils.IS_WINDOWS)
|
||||
{
|
||||
cssClassName
|
||||
= "net.java.sip.communicator.plugin.addrbook"
|
||||
+ ".msoutlook.MsOutlookAddrBookContactSourceService";
|
||||
}
|
||||
else if (OSUtils.IS_MAC)
|
||||
{
|
||||
cssClassName
|
||||
= "net.java.sip.communicator.plugin.addrbook"
|
||||
+ ".macosx.MacOSXAddrBookContactSourceService";
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
css = (ContactSourceService) Class.forName(cssClassName).newInstance();
|
||||
try
|
||||
{
|
||||
cssServiceRegistration
|
||||
= bundleContext.registerService(
|
||||
ContactSourceService.class.getName(),
|
||||
css,
|
||||
null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (cssServiceRegistration == null)
|
||||
{
|
||||
if (css instanceof AsyncContactSourceService)
|
||||
((AsyncContactSourceService) css).stop();
|
||||
css = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the addrbook plug-in.
|
||||
*
|
||||
* @param bundleContext the <tt>BundleContext</tt> in which the addrbook
|
||||
* plug-in is to be stopped
|
||||
* @throws Exception if anything goes wrong while stopping the addrbook
|
||||
* plug-in
|
||||
* @see BundleActivator#stop(BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext bundleContext)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (cssServiceRegistration != null)
|
||||
{
|
||||
cssServiceRegistration.unregister();
|
||||
cssServiceRegistration = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (css != null)
|
||||
{
|
||||
if (css instanceof AsyncContactSourceService)
|
||||
((AsyncContactSourceService) css).stop();
|
||||
css = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.addrbook;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.service.contactsource.*;
|
||||
|
||||
/**
|
||||
* Provides an abstract implementation of a <tt>ContactQuery</tt> which runs in
|
||||
* a separate <tt>Thread</tt>.
|
||||
*
|
||||
* @author Lyubomir Marinov
|
||||
* @param <T> the very type of <tt>ContactSourceService</tt> which performs the
|
||||
* <tt>ContactQuery</tt>
|
||||
*/
|
||||
public abstract class AsyncContactQuery<T extends ContactSourceService>
|
||||
extends AbstractContactQuery<T>
|
||||
{
|
||||
|
||||
/**
|
||||
* The <tt>String</tt> for which the associated
|
||||
* <tt>ContactSourceService</tt> is being queried.
|
||||
*/
|
||||
protected final String query;
|
||||
|
||||
/**
|
||||
* The <tt>SourceContact</tt>s which match {@link #query}.
|
||||
*/
|
||||
private final List<SourceContact> queryResults
|
||||
= new LinkedList<SourceContact>();
|
||||
|
||||
/**
|
||||
* The <tt>Thread</tt> in which this <tt>AsyncContactQuery</tt> is
|
||||
* performing {@link #query}.
|
||||
*/
|
||||
private Thread thread;
|
||||
|
||||
/**
|
||||
* Initializes a new <tt>AsyncContactQuery</tt> instance which is to perform
|
||||
* a specific <tt>query</tt> on behalf of a specific <tt>contactSource</tt>.
|
||||
*
|
||||
* @param contactSource the <tt>ContactSourceService</tt> which is to
|
||||
* perform the new <tt>ContactQuery</tt> instance
|
||||
* @param query the <tt>String</tt> for which <tt>contactSource</tt> is
|
||||
* being queried
|
||||
*/
|
||||
protected AsyncContactQuery(T contactSource, String query)
|
||||
{
|
||||
super(contactSource);
|
||||
|
||||
this.query = (query == null) ? null : query.toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a specific <tt>SourceContact</tt> to the list of
|
||||
* <tt>SourceContact</tt>s to be returned by this <tt>ContactQuery</tt> in
|
||||
* response to {@link #getQueryResults()}.
|
||||
*
|
||||
* @param sourceContact the <tt>SourceContact</tt> to be added to the
|
||||
* <tt>queryResults</tt> of this <tt>ContactQuery</tt>
|
||||
* @return <tt>true</tt> if the <tt>queryResults</tt> of this
|
||||
* <tt>ContactQuery</tt> has changed in response to the call
|
||||
*/
|
||||
protected boolean addQueryResult(SourceContact sourceContact)
|
||||
{
|
||||
boolean changed;
|
||||
|
||||
synchronized (queryResults)
|
||||
{
|
||||
changed = queryResults.add(sourceContact);
|
||||
}
|
||||
if (changed)
|
||||
fireContactReceived(sourceContact);
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the <tt>List</tt> of <tt>SourceContact</tt>s which match this
|
||||
* <tt>ContactQuery</tt>.
|
||||
*
|
||||
* @return the <tt>List</tt> of <tt>SourceContact</tt>s which match this
|
||||
* <tt>ContactQuery</tt>
|
||||
* @see ContactQuery#getQueryResults()
|
||||
*/
|
||||
public List<SourceContact> getQueryResults()
|
||||
{
|
||||
List<SourceContact> qr;
|
||||
|
||||
synchronized (queryResults)
|
||||
{
|
||||
qr = new ArrayList<SourceContact>(queryResults.size());
|
||||
qr.addAll(queryResults);
|
||||
}
|
||||
return qr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs this <tt>ContactQuery</tt> in a background <tt>Thread</tt>.
|
||||
*/
|
||||
protected abstract void run();
|
||||
|
||||
/**
|
||||
* Starts this <tt>AsyncContactQuery</tt>.
|
||||
*/
|
||||
public synchronized void start()
|
||||
{
|
||||
if (thread == null)
|
||||
{
|
||||
thread
|
||||
= new Thread()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
AsyncContactQuery.this.run();
|
||||
}
|
||||
finally
|
||||
{
|
||||
synchronized (AsyncContactQuery.this)
|
||||
{
|
||||
if (thread == Thread.currentThread())
|
||||
stopped();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
}
|
||||
else
|
||||
throw new IllegalStateException("thread");
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies this <tt>AsyncContactQuery</tt> that it has stopped performing
|
||||
* in the associated background <tt>Thread</tt>.
|
||||
*/
|
||||
protected void stopped()
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.addrbook;
|
||||
|
||||
import net.java.sip.communicator.service.contactsource.*;
|
||||
|
||||
/**
|
||||
* Declares the interface of a <tt>ContactSourceService</tt> which performs
|
||||
* <tt>ContactQuery</tt>s in a separate <tt>Thread</tt>.
|
||||
*
|
||||
* @author Lyubomir Marinov
|
||||
*/
|
||||
public interface AsyncContactSourceService
|
||||
extends ContactSourceService
|
||||
{
|
||||
/**
|
||||
* Stops this <tt>ContactSourceService</tt>.
|
||||
*/
|
||||
public void stop();
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
Bundle-Activator: net.java.sip.communicator.plugin.addrbook.AddrBookActivator
|
||||
Bundle-Description: OS-specific Address Book support
|
||||
Bundle-Name: OS-specific Address Book support
|
||||
Bundle-Vendor: sip-communicator.org
|
||||
Bundle-Version: 0.0.1
|
||||
Import-Package: net.java.sip.communicator.service.contactsource,
|
||||
net.java.sip.communicator.service.protocol,
|
||||
net.java.sip.communicator.util,
|
||||
org.osgi.framework
|
||||
System-Bundle: yes
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.addrbook.macosx;
|
||||
|
||||
import net.java.sip.communicator.plugin.addrbook.*;
|
||||
|
||||
/**
|
||||
* Implements <tt>ContactQuery</tt> for the Address Book of Mac OS X.
|
||||
*
|
||||
* @author Lyubomir Marinov
|
||||
*/
|
||||
public class MacOSXAddrBookContactQuery
|
||||
extends AsyncContactQuery<MacOSXAddrBookContactSourceService>
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes a new <tt>MacOSXAddrBookContactQuery</tt> which is to perform
|
||||
* a specific <tt>query</tt> in the Address Book of Mac OS X on behalf of a
|
||||
* specific <tt>MacOSXAddrBookContactSourceService</tt>.
|
||||
*
|
||||
* @param contactSource the <tt>MacOSXAddrBookContactSourceService</tt>
|
||||
* which is to perform the new <tt>ContactQuery</tt> instance
|
||||
* @param query the <tt>String</tt> for which <tt>contactSource</tt> i.e.
|
||||
* the Address Book of Mac OS X is being queried
|
||||
*/
|
||||
public MacOSXAddrBookContactQuery(
|
||||
MacOSXAddrBookContactSourceService contactSource,
|
||||
String query)
|
||||
{
|
||||
super(contactSource, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs this <tt>AsyncContactQuery</tt> in a background <tt>Thread</tt>.
|
||||
*
|
||||
* @see AsyncContactQuery#run()
|
||||
*/
|
||||
protected void run()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.addrbook.macosx;
|
||||
|
||||
import net.java.sip.communicator.service.contactsource.*;
|
||||
|
||||
/**
|
||||
* Implements <tt>ContactSourceService</tt> for the Address Book of Mac OS X.
|
||||
*
|
||||
* @author Lyubomir Marinov
|
||||
*/
|
||||
public class MacOSXAddrBookContactSourceService
|
||||
implements ContactSourceService
|
||||
{
|
||||
/**
|
||||
* Initializes a new <tt>MacOSXAddrBookContactSourceService</tt> instance.
|
||||
*/
|
||||
public MacOSXAddrBookContactSourceService()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a human-readable <tt>String</tt> which names this
|
||||
* <tt>ContactSourceService</tt> implementation.
|
||||
*
|
||||
* @return a human-readable <tt>String</tt> which names this
|
||||
* <tt>ContactSourceService</tt> implementation
|
||||
* @see ContactSourceService#getDisplayName()
|
||||
*/
|
||||
public String getDisplayName()
|
||||
{
|
||||
return "Mac OS X Address Book";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a <tt>String</tt> which uniquely identifies the instances of the
|
||||
* <tt>MacOSXAddrBookContactSourceService</tt> implementation.
|
||||
*
|
||||
* @return a <tt>String</tt> which uniquely identifies the instances of the
|
||||
* <tt>MacOSXAddrBookContactSourceService</tt> implementation
|
||||
* @see ContactSourceService#getIdentifier()
|
||||
*/
|
||||
public String getIdentifier()
|
||||
{
|
||||
return "MacOSXAddressBook";
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries this <tt>ContactSourceService</tt> for <tt>SourceContact</tt>s
|
||||
* which match a specific <tt>query</tt> <tt>String</tt>.
|
||||
*
|
||||
* @param query the <tt>String</tt> which this <tt>ContactSourceService</tt>
|
||||
* is being queried for
|
||||
* @return a <tt>ContactQuery</tt> which represents the query of this
|
||||
* <tt>ContactSourceService</tt> implementation for the specified
|
||||
* <tt>String</tt> and via which the matching <tt>SourceContact</tt>s (if
|
||||
* any) will be returned
|
||||
* @see ContactSourceService#queryContactSource(String)
|
||||
*/
|
||||
public ContactQuery queryContactSource(String query)
|
||||
{
|
||||
MacOSXAddrBookContactQuery mosxabcq
|
||||
= new MacOSXAddrBookContactQuery(this, query);
|
||||
|
||||
mosxabcq.start();
|
||||
return mosxabcq;
|
||||
}
|
||||
}
|
||||
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
package net.java.sip.communicator.plugin.msoutlook;
|
||||
|
||||
import net.java.sip.communicator.service.contactsource.*;
|
||||
|
||||
import org.osgi.framework.*;
|
||||
|
||||
/**
|
||||
* Implements <tt>BundleActivator</tt> for the msoutlook plug-in which provides
|
||||
* support for Microsoft Outlook.
|
||||
*
|
||||
* @author Lyubomir Marinov
|
||||
*/
|
||||
public class MsOutlookActivator
|
||||
implements BundleActivator
|
||||
{
|
||||
/**
|
||||
* The <tt>MsOutlookAddressBookContactSourceService</tt> which implements
|
||||
* <tt>ContactSourceService</tt> for the Address Book of Microsoft Outlook.
|
||||
*/
|
||||
private MsOutlookAddressBookContactSourceService msoabcss;
|
||||
|
||||
/**
|
||||
* The <tt>ServiceRegistration</tt> of {@link #msoabcss} in the
|
||||
* <tt>BundleContext</tt> in which this <tt>MsOutlookActivator</tt> has been
|
||||
* started.
|
||||
*/
|
||||
private ServiceRegistration msoabcssServiceRegistration;
|
||||
|
||||
/**
|
||||
* Starts the msoutlook plug-in.
|
||||
*
|
||||
* @param bundleContext the <tt>BundleContext</tt> in which the msoutlook
|
||||
* plug-in is to be started
|
||||
* @throws Exception if anything goes wrong while starting the msoutlook
|
||||
* plug-in
|
||||
* @see BundleActivator#start(BundleContext)
|
||||
*/
|
||||
public void start(BundleContext bundleContext)
|
||||
throws Exception
|
||||
{
|
||||
msoabcss = new MsOutlookAddressBookContactSourceService();
|
||||
try
|
||||
{
|
||||
msoabcssServiceRegistration
|
||||
= bundleContext.registerService(
|
||||
ContactSourceService.class.getName(),
|
||||
msoabcss,
|
||||
null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (msoabcssServiceRegistration == null)
|
||||
{
|
||||
msoabcss.stop();
|
||||
msoabcss = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the msoutlook plug-in.
|
||||
*
|
||||
* @param bundleContext the <tt>BundleContext</tt> in which the msoutlook
|
||||
* plug-in is to be stopped
|
||||
* @throws Exception if anything goes wrong while stopping the msoutlook
|
||||
* plug-in
|
||||
* @see BundleActivator#stop(BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext bundleContext)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (msoabcssServiceRegistration != null)
|
||||
{
|
||||
msoabcssServiceRegistration.unregister();
|
||||
msoabcssServiceRegistration = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (msoabcss != null)
|
||||
{
|
||||
msoabcss.stop();
|
||||
msoabcss = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
Bundle-Activator: net.java.sip.communicator.plugin.msoutlook.MsOutlookActivator
|
||||
Bundle-Description: Microsoft Outlook support
|
||||
Bundle-Name: Microsoft Outlook support
|
||||
Bundle-Vendor: sip-communicator.org
|
||||
Bundle-Version: 0.0.1
|
||||
Import-Package: net.java.sip.communicator.service.contactsource,
|
||||
net.java.sip.communicator.service.protocol,
|
||||
org.osgi.framework
|
||||
System-Bundle: yes
|
||||
Loading…
Reference in new issue