diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-01-04 18:07:04 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-01-04 18:07:04 +0000 |
commit | 362d8bc4468bc3fd47b56965f8886ace78d4e74e (patch) | |
tree | c2ffc5d369cafbf8a315fa26b7aab097265e900b | |
parent | c3cdd80b03237809146e5445c6cc5d009c454ae4 (diff) | |
download | jitsi-362d8bc4468bc3fd47b56965f8886ace78d4e74e.zip jitsi-362d8bc4468bc3fd47b56965f8886ace78d4e74e.tar.gz jitsi-362d8bc4468bc3fd47b56965f8886ace78d4e74e.tar.bz2 |
Commits work in progress on adding support for the Address Book of Mac OS X.
30 files changed, 625 insertions, 389 deletions
@@ -726,14 +726,6 @@ <os arch="i386" /> </condition> - <!-- Start the OS-specific Address Book ContactSourceService - implementations. --> - <condition property="felix.auto.start.addrbookcontactsrc" - value="reference:file:sc-bundles/msoutlook.jar" - else=""> - <isset property="is.running.windows" /> - </condition> - <!-- forking prevents from debugging --> <java classname="net.java.sip.communicator.launcher.SIPCommunicator" fork="true" @@ -755,12 +747,14 @@ value="${java.net.preferIPv6Addresses}"/> <!--sysproperty key="net.java.sip.communicator.SC_HOME_DIR_LOCATION" - value="${user.home}/schome"/--> + value="${user.home}"/> + <sysproperty key="net.java.sip.communicator.SC_HOME_DIR_NAME" + value="schome"/--> - <sysproperty key="smack.debugEnabled" - value="${smack.debugEnabled}"/> - <!--sysproperty key="smack.debuggerClass" - value="org.jivesoftware.smack.debugger.ConsoleDebugger"/--> + <sysproperty key="smack.debugEnabled" + value="${smack.debugEnabled}"/> + <!--sysproperty key="smack.debuggerClass" + value="org.jivesoftware.smack.debugger.ConsoleDebugger"/--> <!-- Setting properties necessary for dependencies on native libs.--> <sysproperty key="java.library.path" @@ -796,11 +790,6 @@ -client ${jvm.maxheapsize}"/> <sysproperty key="apple.laf.useScreenMenuBar" value="true" /> - - <!-- Start the OS-specific Address Book ContactSourceService - implementations. --> - <sysproperty key="felix.auto.start.69" - value="${felix.auto.start.addrbookcontactsrc}"/> </java> </target> @@ -935,7 +924,7 @@ bundle-twitpic,bundle-directimage,bundle-bliptv,bundle-viddler, bundle-plugin-chatconfig,bundle-certificate,bundle-packetlogging, bundle-provdisc,bundle-provdisc-dhcp,bundle-provdisc-mdns, - bundle-provisioning,bundle-msoutlook"/> + bundle-provisioning,bundle-addrbook"/> <!--BUNDLE-SC-LAUNCHER--> <target name="bundle-sc-launcher"> @@ -2592,13 +2581,13 @@ org.apache.http.util"/> </jar> </target> - <!-- BUNDLE-PLUGIN-MSOUTLOOK --> - <target name="bundle-msoutlook"> - <!-- Creates a bundle which provides support for Microsoft Outlook. --> - <jar compress="false" destfile="${bundles.dest.win}/msoutlook.jar" - manifest="${src}/net/java/sip/communicator/plugin/msoutlook/msoutlook.manifest.mf"> - <zipfileset dir="${dest}/net/java/sip/communicator/plugin/msoutlook" - prefix="net/java/sip/communicator/plugin/msoutlook" /> + <!-- BUNDLE-PLUGIN-ADDRBOOK --> + <target name="bundle-addrbook"> + <!-- Creates a bundle which provides support for the OS-specific Address Book. --> + <jar compress="false" destfile="${bundles.dest}/addrbook.jar" + manifest="${src}/net/java/sip/communicator/plugin/addrbook/addrbook.manifest.mf"> + <zipfileset dir="${dest}/net/java/sip/communicator/plugin/addrbook" + prefix="net/java/sip/communicator/plugin/addrbook" /> </jar> </target> diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties index 2e8aca9..4cd6858 100644 --- a/lib/felix.client.run.properties +++ b/lib/felix.client.run.properties @@ -142,16 +142,12 @@ felix.auto.start.67= \ reference:file:sc-bundles/replacement-directimage.jar \ reference:file:sc-bundles/replacement-bliptv.jar \ reference:file:sc-bundles/replacement-viddler.jar \ - reference:file:sc-bundles/chatconfig.jar - + reference:file:sc-bundles/chatconfig.jar \ + reference:file:sc-bundles/addrbook.jar # Level 68 is for profiler4j. Either don't use it or change the build.xml file # accordingly. -# Level 69 is for the OS-specific Address Book ContactSourceService -# implementations. Either don't use it or change the build.xml file accordingly. -#felix.auto.start.69= - felix.auto.start.70= \ reference:file:sc-bundles/simpleaccreg.jar \ reference:file:sc-bundles/securityconfig.jar \ diff --git a/lib/native/windows-64/jmsoutlook.dll b/lib/native/windows-64/jmsoutlook.dll Binary files differdeleted file mode 100644 index 13b8346..0000000 --- a/lib/native/windows-64/jmsoutlook.dll +++ /dev/null diff --git a/lib/native/windows/jmsoutlook.dll b/lib/native/windows/jmsoutlook.dll Binary files differdeleted file mode 100644 index 43efd4b..0000000 --- a/lib/native/windows/jmsoutlook.dll +++ /dev/null diff --git a/resources/install/build.xml b/resources/install/build.xml index 54281ca..f3c0521 100644 --- a/resources/install/build.xml +++ b/resources/install/build.xml @@ -499,15 +499,6 @@ </copy> <!-- - Start OS-specific bundles in felix.client.run.properties such as the - Address Book ContactSourceService implementations at level 69. - --> - <replace file="${light.dir}/lib/felix.client.run.properties" - token="#felix.auto.start.69="> - <replacevalue><![CDATA[felix.auto.start.69=reference:file:sc-bundles/msoutlook.jar]]></replacevalue> - </replace> - - <!-- This update-location.properties file is the only of interest to the MSI i.e. it gets installed on the user machine. --> diff --git a/src/native/windows/msoutlook/Makefile b/src/native/addrbook/msoutlook/Makefile index c5d9fb4..32d05f7 100644 --- a/src/native/windows/msoutlook/Makefile +++ b/src/native/addrbook/msoutlook/Makefile @@ -12,11 +12,11 @@ endif CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(OUTLOOK_MAPI_HEADERS) LDFLAGS = -shared -Wl,--kill-at LIBS = -lmapi32 -TARGET = ../../../../lib/native/windows$(ARCH)/jmsoutlook.dll +TARGET = ../../../../lib/native/windows$(ARCH)/jmsoutlookaddrbook.dll $(TARGET): \ MsOutlookMAPIHResultException.cpp \ - net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.cpp \ - net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.c + net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp \ + net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c $(CXX) $(CPPFLAGS) $^ $(LDFLAGS) -o $@ $(LIBS) -strip $(TARGET) diff --git a/src/native/addrbook/msoutlook/MsOutlookMAPI.h b/src/native/addrbook/msoutlook/MsOutlookMAPI.h new file mode 100644 index 0000000..0562e9d --- /dev/null +++ b/src/native/addrbook/msoutlook/MsOutlookMAPI.h @@ -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_ */
diff --git a/src/native/windows/msoutlook/MsOutlookMAPIHResultException.cpp b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp index 180f433..115e6f0 100644 --- a/src/native/windows/msoutlook/MsOutlookMAPIHResultException.cpp +++ b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp @@ -8,7 +8,7 @@ MsOutlookMAPIHResultException_throwNew clazz
= jniEnv->FindClass(
- "net/java/sip/communicator/plugin/msoutlook/MsOutlookMAPIHResultException");
+ "net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMAPIHResultException");
if (clazz)
{
LPCTSTR message;
diff --git a/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h new file mode 100644 index 0000000..8f87de1 --- /dev/null +++ b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.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_ */
\ No newline at end of file diff --git a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.cpp b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp index 4c7d2a4..2c62b52 100644 --- a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.cpp +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp @@ -1,4 +1,4 @@ -#include "net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.h"
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
#include "MsOutlookMAPI.h"
#include "MsOutlookMAPIHResultException.h"
@@ -11,18 +11,18 @@ static void Exception_throwNew
(JNIEnv *jniEnv, const char *className, const char *message);
-static jboolean MsOutlookAddressBookContactQuery_foreachMailUser
+static jboolean MsOutlookAddrBookContactQuery_foreachMailUser
(ULONG objType, LPUNKNOWN iUnknown,
JNIEnv *jniEnv,
jstring query,
jobject callback, jmethodID callbackMethodID);
-static jboolean MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable
+static jboolean MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable
(LPMAPICONTAINER mapiContainer, LPMAPITABLE mapiTable,
JNIEnv *jniEnv,
jstring query,
jobject callback, jmethodID callbackMethodID);
-static void MsOutlookAddressBookContactQuery_freeSRowSet(LPSRowSet rows);
-static jboolean MsOutlookAddressBookContactQuery_mailUserMatches
+static void MsOutlookAddrBookContactQuery_freeSRowSet(LPSRowSet rows);
+static jboolean MsOutlookAddrBookContactQuery_mailUserMatches
(LPMAPIPROP mailUser, JNIEnv *jniEnv, jstring query);
static void
@@ -36,7 +36,7 @@ Exception_throwNew(JNIEnv *jniEnv, const char *className, const char *message) }
JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery_foreachMailUser
+Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_foreachMailUser
(JNIEnv *jniEnv, jclass clazz, jstring query, jobject callback)
{
jclass callbackClass;
@@ -85,7 +85,7 @@ Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery hResult = adrBook->OpenEntry(0, NULL, NULL, 0, &objType, &iUnknown);
if (HR_SUCCEEDED(hResult))
{
- MsOutlookAddressBookContactQuery_foreachMailUser(
+ MsOutlookAddrBookContactQuery_foreachMailUser(
objType, iUnknown,
jniEnv, query, callback, callbackMethodID);
@@ -122,7 +122,7 @@ Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery }
JNIEXPORT jobjectArray JNICALL
-Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery_IMAPIProp_1GetProps
+Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_IMAPIProp_1GetProps
(JNIEnv *jniEnv, jclass clazz,
jlong mapiProp, jlongArray propIds, jlong flags)
{
@@ -246,7 +246,7 @@ Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery }
static jboolean
-MsOutlookAddressBookContactQuery_foreachMailUser
+MsOutlookAddrBookContactQuery_foreachMailUser
(ULONG objType, LPUNKNOWN iUnknown,
JNIEnv *jniEnv,
jstring query,
@@ -271,7 +271,7 @@ MsOutlookAddressBookContactQuery_foreachMailUser if (HR_SUCCEEDED(hResult) && mapiTable)
{
proceed
- = MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable(
+ = MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable(
mapiContainer, mapiTable,
jniEnv, query, callback, callbackMethodID);
mapiTable->Release();
@@ -285,7 +285,7 @@ MsOutlookAddressBookContactQuery_foreachMailUser if (HR_SUCCEEDED(hResult) && mapiTable)
{
proceed
- = MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable(
+ = MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable(
mapiContainer, mapiTable,
jniEnv, query, callback, callbackMethodID);
mapiTable->Release();
@@ -298,7 +298,7 @@ MsOutlookAddressBookContactQuery_foreachMailUser case MAPI_MAILUSER:
{
if (JNI_TRUE
- == MsOutlookAddressBookContactQuery_mailUserMatches(
+ == MsOutlookAddrBookContactQuery_mailUserMatches(
(LPMAPIPROP) iUnknown,
jniEnv, query))
{
@@ -323,7 +323,7 @@ MsOutlookAddressBookContactQuery_foreachMailUser }
static jboolean
-MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable
+MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable
(LPMAPICONTAINER mapiContainer, LPMAPITABLE mapiTable,
JNIEnv *jniEnv,
jstring query,
@@ -383,7 +383,7 @@ MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable * We no longer need the rows at this point so free them
* before we drill down the hierarchy and allocate even more rows.
*/
- MsOutlookAddressBookContactQuery_freeSRowSet(rows);
+ MsOutlookAddrBookContactQuery_freeSRowSet(rows);
hResult
= mapiContainer->OpenEntry(
@@ -394,7 +394,7 @@ MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable if (HR_SUCCEEDED(hResult))
{
proceed
- = MsOutlookAddressBookContactQuery_foreachMailUser(
+ = MsOutlookAddrBookContactQuery_foreachMailUser(
objType, iUnknown,
jniEnv, query, callback, callbackMethodID);
iUnknown->Release();
@@ -403,10 +403,10 @@ MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable MAPIFreeBuffer(entryID);
}
else
- MsOutlookAddressBookContactQuery_freeSRowSet(rows);
+ MsOutlookAddrBookContactQuery_freeSRowSet(rows);
}
else
- MsOutlookAddressBookContactQuery_freeSRowSet(rows);
+ MsOutlookAddrBookContactQuery_freeSRowSet(rows);
}
else
{
@@ -424,7 +424,7 @@ MsOutlookAddressBookContactQuery_foreachMailUserInContainerTable }
static void
-MsOutlookAddressBookContactQuery_freeSRowSet(LPSRowSet rows)
+MsOutlookAddrBookContactQuery_freeSRowSet(LPSRowSet rows)
{
ULONG i;
@@ -444,7 +444,7 @@ MsOutlookAddressBookContactQuery_freeSRowSet(LPSRowSet rows) }
static jboolean
-MsOutlookAddressBookContactQuery_mailUserMatches
+MsOutlookAddrBookContactQuery_mailUserMatches
(LPMAPIPROP mailUser, JNIEnv *jniEnv, jstring query)
{
// TODO Auto-generated method stub
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h new file mode 100644 index 0000000..156999c --- /dev/null +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h @@ -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
diff --git a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.c b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c index 5f9614c..10a82c2 100644 --- a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.c +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c @@ -1,10 +1,10 @@ -#include "net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.h"
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
#include "MsOutlookMAPI.h"
#include "MsOutlookMAPIHResultException.h"
JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService_MAPIInitialize
+Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIInitialize
(JNIEnv *jniEnv, jclass clazz, jlong version, jlong flags)
{
MAPIINIT_0 mapiInit = { (ULONG) version, (ULONG) flags };
@@ -22,7 +22,7 @@ Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourc }
JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService_MAPIUninitialize
+Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIUninitialize
(JNIEnv *jniEnv, jclass clazz)
{
MAPIUninitialize();
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h new file mode 100644 index 0000000..6b03cbb --- /dev/null +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h @@ -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
diff --git a/src/native/windows/msoutlook/MsOutlookMAPI.h b/src/native/windows/msoutlook/MsOutlookMAPI.h deleted file mode 100644 index 2d789ea..0000000 --- a/src/native/windows/msoutlook/MsOutlookMAPI.h +++ /dev/null @@ -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_ */
diff --git a/src/native/windows/msoutlook/MsOutlookMAPIHResultException.h b/src/native/windows/msoutlook/MsOutlookMAPIHResultException.h deleted file mode 100644 index 1f79538..0000000 --- a/src/native/windows/msoutlook/MsOutlookMAPIHResultException.h +++ /dev/null @@ -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_ */
\ No newline at end of file diff --git a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.h b/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.h deleted file mode 100644 index c1ba6d9..0000000 --- a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactQuery.h +++ /dev/null @@ -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
diff --git a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.h b/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.h deleted file mode 100644 index 0e22a64..0000000 --- a/src/native/windows/msoutlook/net_java_sip_communicator_plugin_msoutlook_MsOutlookAddressBookContactSourceService.h +++ /dev/null @@ -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
diff --git a/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java b/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java new file mode 100644 index 0000000..854972d --- /dev/null +++ b/src/net/java/sip/communicator/plugin/addrbook/AddrBookActivator.java @@ -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;
+ }
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java new file mode 100644 index 0000000..d03742c --- /dev/null +++ b/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java @@ -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()
+ {
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/addrbook/AsyncContactSourceService.java b/src/net/java/sip/communicator/plugin/addrbook/AsyncContactSourceService.java new file mode 100644 index 0000000..ab12921 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/addrbook/AsyncContactSourceService.java @@ -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();
+}
diff --git a/src/net/java/sip/communicator/plugin/addrbook/addrbook.manifest.mf b/src/net/java/sip/communicator/plugin/addrbook/addrbook.manifest.mf new file mode 100644 index 0000000..f8b1032 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/addrbook/addrbook.manifest.mf @@ -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
diff --git a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java new file mode 100644 index 0000000..68be1f4 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java @@ -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
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactSourceService.java b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactSourceService.java new file mode 100644 index 0000000..eb27bd1 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactSourceService.java @@ -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;
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookCallback.java b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookAddrBookCallback.java index 3f18e62..1b80348 100644 --- a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookCallback.java +++ b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookAddrBookCallback.java @@ -4,7 +4,7 @@ * Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.plugin.msoutlook;
+package net.java.sip.communicator.plugin.addrbook.msoutlook;
/**
* Defines the interface for a callback function which is called by the Address
@@ -13,15 +13,15 @@ package net.java.sip.communicator.plugin.msoutlook; *
* @author Lyubomir Marinov
*/
-public interface MsOutlookAddressBookCallback
+public interface MsOutlookAddrBookCallback
{
/**
- * Notifies this <tt>MsOutlookAddressBookCallback</tt> about a specific
+ * Notifies this <tt>MsOutlookAddrBookCallback</tt> about a specific
* <tt>IUnknown</tt>.
*
* @param iUnknown the pointer to the <tt>IUnknown</tt> instance to notify
- * this <tt>MsOutlookAddressBookCallback</tt> about
- * @return <tt>true</tt> if this <tt>MsOutlookAddressBookCallback</tt> is to
+ * this <tt>MsOutlookAddrBookCallback</tt> about
+ * @return <tt>true</tt> if this <tt>MsOutlookAddrBookCallback</tt> is to
* continue being called; otherwise, <tt>false</tt>
*/
boolean callback(long iUnknown);
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookAddrBookContactQuery.java index 4e178b1..8757fd9 100644 --- a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookContactQuery.java +++ b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookAddrBookContactQuery.java @@ -4,10 +4,11 @@ * Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.plugin.msoutlook;
+package net.java.sip.communicator.plugin.addrbook.msoutlook;
import java.util.*;
+import net.java.sip.communicator.plugin.addrbook.*;
import net.java.sip.communicator.service.contactsource.*;
/**
@@ -15,13 +16,13 @@ import net.java.sip.communicator.service.contactsource.*; *
* @author Lyubomir Marinov
*/
-public class MsOutlookAddressBookContactQuery
- extends AbstractContactQuery<MsOutlookAddressBookContactSourceService>
+public class MsOutlookAddrBookContactQuery
+ extends AsyncContactQuery<MsOutlookAddrBookContactSourceService>
{
/**
* The IDs of the properties of <tt>MAPI_MAILUSER</tt> which are to be
- * queried by the <tt>MsOutlookAddressBookContactQuery</tt> instances.
+ * queried by the <tt>MsOutlookAddrBookContactQuery</tt> instances.
*/
private static final long[] MAPI_MAILUSER_PROP_IDS
= new long[]
@@ -122,80 +123,40 @@ public class MsOutlookAddressBookContactQuery static
{
- System.loadLibrary("jmsoutlook");
+ System.loadLibrary("jmsoutlookaddrbook");
}
/**
- * The <tt>String</tt> for which the associated
- * <tt>MsOutlookAddressBookContactSourceService</tt> is being queried.
- */
- private 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>MsOutlookAddressBookContactQuery</tt> is performing {@link #query}.
- */
- private Thread thread;
-
- /**
- * Initializes a new <tt>MsOutlookAddressBookContactQuery</tt> instance to
+ * Initializes a new <tt>MsOutlookAddrBookContactQuery</tt> instance to
* be performed by a specific
- * <tt>MsOutlookAddressBookContactSourceService</tt>.
+ * <tt>MsOutlookAddrBookContactSourceService</tt>.
*
- * @param msoabcss the <tt>MsOutlookAddressBookContactSourceService</tt>
+ * @param msoabcss the <tt>MsOutlookAddrBookContactSourceService</tt>
* which is to perform the new <tt>ContactQuery</tt>
* @param query the <tt>String</tt> for which <tt>msoabcss</tt> is being
* queried
*/
- public MsOutlookAddressBookContactQuery(
- MsOutlookAddressBookContactSourceService msoabcss,
+ public MsOutlookAddrBookContactQuery(
+ MsOutlookAddrBookContactSourceService msoabcss,
String query)
{
- super(msoabcss);
-
- this.query = (query == null) ? null : query.toLowerCase();
+ super(msoabcss, query);
}
/**
- * Calls back to a specific <tt>MsOutlookAddressBookCallback</tt> for each
+ * Calls back to a specific <tt>MsOutlookAddrBookCallback</tt> for each
* <tt>MAPI_MAILUSER</tt> found in the Address Book of Microsoft Outlook
* which matches a specific <tt>String</tt>.
*
* @param query the <tt>String</tt> for which the Address Book of Microsoft
* Outlook is to be queried. <bb>Warning</bb>: Ignored at the time of this
* writing.
- * @param callback the <tt>MsOutlookAddressBookCallback</tt> to be notified
+ * @param callback the <tt>MsOutlookAddrBookCallback</tt> to be notified
* about the matching <tt>MAPI_MAILUSER</tt>s
*/
private static native void foreachMailUser(
String query,
- MsOutlookAddressBookCallback callback);
-
- /**
- * 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;
- }
+ MsOutlookAddrBookCallback callback);
private static native Object[] IMAPIProp_GetProps(
long mapiProp,
@@ -203,12 +164,12 @@ public class MsOutlookAddressBookContactQuery throws MsOutlookMAPIHResultException;
/**
- * Notifies this <tt>MsOutlookAddressBookContactQuery</tt> about a specific
+ * Notifies this <tt>MsOutlookAddrBookContactQuery</tt> about a specific
* <tt>MAPI_MAILUSER</tt>.
*
* @param iUnknown a pointer to an <tt>IUnknown</tt> instance for the
* <tt>MAPI_MAILUSER</tt> to notify about
- * @return <tt>true</tt> if this <tt>MsOutlookAddressBookContactQuery</tt>
+ * @return <tt>true</tt> if this <tt>MsOutlookAddrBookContactQuery</tt>
* is to continue being called; otherwise, <tt>false</tt>
* @throws MsOutlookMAPIHResultException if anything goes wrong while
* getting the properties of the specified <tt>MAPI_MAILUSER</tt>
@@ -256,61 +217,46 @@ public class MsOutlookAddressBookContactQuery (String) props[PR_DISPLAY_NAME_INDEX],
contactDetails);
- queryResults.add(sourceContact);
- fireContactReceived(sourceContact);
+ addQueryResult(sourceContact);
}
return (getStatus() == QUERY_IN_PROGRESS);
}
/**
- * Starts this <tt>MsOutlookAddressBookContactQuery</tt>.
+ * Performs this <tt>AsyncContactQuery</tt> in a background <tt>Thread</tt>.
+ *
+ * @see AsyncContactQuery#run()
*/
- synchronized void start()
+ protected void run()
{
- if (thread == null)
- {
- thread
- = new Thread()
+ foreachMailUser(
+ query,
+ new MsOutlookAddrBookCallback()
+ {
+ public boolean callback(long iUnknown)
{
- @Override
- public void run()
+ try
{
- try
- {
- foreachMailUser(
- query,
- new MsOutlookAddressBookCallback()
- {
- public boolean callback(long iUnknown)
- {
- try
- {
- return onMailUser(iUnknown);
- }
- catch (MsOutlookMAPIHResultException ex)
- {
- ex.printStackTrace(System.err);
- return false;
- }
- }
- });
- }
- finally
- {
- synchronized (MsOutlookAddressBookContactQuery.this)
- {
- if (thread == Thread.currentThread())
- {
- getContactSource().stopped(
- MsOutlookAddressBookContactQuery.this);
- }
- }
- }
+ return onMailUser(iUnknown);
}
- };
- thread.start();
- }
- else
- throw new IllegalStateException("thread");
+ catch (MsOutlookMAPIHResultException ex)
+ {
+ ex.printStackTrace(System.err);
+ return false;
+ }
+ }
+ });
+ }
+
+ /**
+ * Notifies this <tt>AsyncContactQuery</tt> that it has stopped performing
+ * in the associated background <tt>Thread</tt>.
+ *
+ * @see AsyncContactQuery#stopped()
+ */
+ @Override
+ protected void stopped()
+ {
+ getContactSource().stopped(this);
}
}
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookContactSourceService.java b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookAddrBookContactSourceService.java index 076d547..fca8320 100644 --- a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookAddressBookContactSourceService.java +++ b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookAddrBookContactSourceService.java @@ -4,10 +4,11 @@ * Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.plugin.msoutlook;
+package net.java.sip.communicator.plugin.addrbook.msoutlook;
import java.util.*;
+import net.java.sip.communicator.plugin.addrbook.*;
import net.java.sip.communicator.service.contactsource.*;
/**
@@ -16,8 +17,8 @@ import net.java.sip.communicator.service.contactsource.*; *
* @author Lyubomir Marinov
*/
-public class MsOutlookAddressBookContactSourceService
- implements ContactSourceService
+public class MsOutlookAddrBookContactSourceService
+ implements AsyncContactSourceService
{
private static final long MAPI_INIT_VERSION = 0;
@@ -25,25 +26,25 @@ public class MsOutlookAddressBookContactSourceService static
{
- System.loadLibrary("jmsoutlook");
+ System.loadLibrary("jmsoutlookaddrbook");
}
/**
- * The <tt>List</tt> of <tt>MsOutlookAddressBookContactQuery</tt> instances
+ * The <tt>List</tt> of <tt>MsOutlookAddrBookContactQuery</tt> instances
* which have been started and haven't stopped yet.
*/
- private final List<MsOutlookAddressBookContactQuery> queries
- = new LinkedList<MsOutlookAddressBookContactQuery>();
+ private final List<MsOutlookAddrBookContactQuery> queries
+ = new LinkedList<MsOutlookAddrBookContactQuery>();
/**
- * Initializes a new <tt>MsOutlookAddressBookContactSourceService</tt>
+ * Initializes a new <tt>MsOutlookAddrBookContactSourceService</tt>
* instance.
*
* @throws MsOutlookMAPIHResultException if anything goes wrong while
- * initializing the new <tt>MsOutlookAddressBookContactSourceService</tt>
+ * initializing the new <tt>MsOutlookAddrBookContactSourceService</tt>
* instance
*/
- public MsOutlookAddressBookContactSourceService()
+ public MsOutlookAddrBookContactSourceService()
throws MsOutlookMAPIHResultException
{
MAPIInitialize(MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS);
@@ -64,10 +65,10 @@ public class MsOutlookAddressBookContactSourceService /**
* Gets a <tt>String</tt> which uniquely identifies the instances of the
- * <tt>MsOutlookAddressBookContactSourceService</tt> implementation.
+ * <tt>MsOutlookAddrBookContactSourceService</tt> implementation.
*
* @return a <tt>String</tt> which uniquely identifies the instances of the
- * <tt>MsOutlookAddressBookContactSourceService</tt> implementation
+ * <tt>MsOutlookAddrBookContactSourceService</tt> implementation
* @see ContactSourceService#getIdentifier()
*/
public String getIdentifier()
@@ -94,8 +95,8 @@ public class MsOutlookAddressBookContactSourceService */
public ContactQuery queryContactSource(String query)
{
- MsOutlookAddressBookContactQuery msoabcq
- = new MsOutlookAddressBookContactQuery(this, query);
+ MsOutlookAddrBookContactQuery msoabcq
+ = new MsOutlookAddrBookContactQuery(this, query);
synchronized (queries)
{
@@ -126,8 +127,10 @@ public class MsOutlookAddressBookContactSourceService /**
* Stops this <tt>ContactSourceService</tt> implementation and prepares it
* for garbage collection.
+ *
+ * @see AsyncContactSourceService#stop()
*/
- void stop()
+ public void stop()
{
boolean interrupted = false;
@@ -153,13 +156,13 @@ public class MsOutlookAddressBookContactSourceService }
/**
- * Notifies this <tt>MsOutlookAddressBookContactSourceService</tt> that a
- * specific <tt>MsOutlookAddressBookContactQuery</tt> has stopped.
+ * Notifies this <tt>MsOutlookAddrBookContactSourceService</tt> that a
+ * specific <tt>MsOutlookAddrBookContactQuery</tt> has stopped.
*
- * @param msoabcq the <tt>MsOutlookAddressBookContactQuery</tt> which has
+ * @param msoabcq the <tt>MsOutlookAddrBookContactQuery</tt> which has
* stopped
*/
- void stopped(MsOutlookAddressBookContactQuery msoabcq)
+ void stopped(MsOutlookAddrBookContactQuery msoabcq)
{
synchronized (queries)
{
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookMAPIHResultException.java b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMAPIHResultException.java index 9c8183a..18e0fa1 100644 --- a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookMAPIHResultException.java +++ b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMAPIHResultException.java @@ -4,7 +4,7 @@ * Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.plugin.msoutlook;
+package net.java.sip.communicator.plugin.addrbook.msoutlook;
/**
* Represents a specific Microsoft Outlook MAPI <tt>HRESULT</tt> as an
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookMailUserSourceContact.java b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMailUserSourceContact.java index 130ebc4..c60c4e7 100644 --- a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookMailUserSourceContact.java +++ b/src/net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMailUserSourceContact.java @@ -4,7 +4,7 @@ * Distributable under LGPL license.
* See terms of license at gnu.org.
*/
-package net.java.sip.communicator.plugin.msoutlook;
+package net.java.sip.communicator.plugin.addrbook.msoutlook;
import java.util.*;
@@ -28,7 +28,7 @@ public class MsOutlookMailUserSourceContact * The <tt>ContactSourceService</tt> which has created this
* <tt>SourceContact</tt>.
*/
- private final MsOutlookAddressBookContactSourceService contactSource;
+ private final MsOutlookAddrBookContactSourceService contactSource;
/**
* The display name of this <tt>SourceContact</tt>.
@@ -44,7 +44,7 @@ public class MsOutlookMailUserSourceContact * @param contactDetails the <tt>ContactDetail</tt>s of the new instance
*/
public MsOutlookMailUserSourceContact(
- MsOutlookAddressBookContactSourceService contactSource,
+ MsOutlookAddrBookContactSourceService contactSource,
String displayName,
List<ContactDetail> contactDetails)
{
@@ -99,7 +99,7 @@ public class MsOutlookMailUserSourceContact * <tt>SourceContact</tt>
* @see SourceContact#getContactSource()
*/
- public MsOutlookAddressBookContactSourceService getContactSource()
+ public MsOutlookAddrBookContactSourceService getContactSource()
{
return contactSource;
}
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookActivator.java b/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookActivator.java deleted file mode 100644 index 2b55fb9..0000000 --- a/src/net/java/sip/communicator/plugin/msoutlook/MsOutlookActivator.java +++ /dev/null @@ -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;
- }
- }
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/msoutlook/msoutlook.manifest.mf b/src/net/java/sip/communicator/plugin/msoutlook/msoutlook.manifest.mf deleted file mode 100644 index f2eb3be..0000000 --- a/src/net/java/sip/communicator/plugin/msoutlook/msoutlook.manifest.mf +++ /dev/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
|