aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/addrbook/msoutlook
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2011-01-04 18:07:04 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2011-01-04 18:07:04 +0000
commit362d8bc4468bc3fd47b56965f8886ace78d4e74e (patch)
treec2ffc5d369cafbf8a315fa26b7aab097265e900b /src/native/addrbook/msoutlook
parentc3cdd80b03237809146e5445c6cc5d009c454ae4 (diff)
downloadjitsi-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.
Diffstat (limited to 'src/native/addrbook/msoutlook')
-rw-r--r--src/native/addrbook/msoutlook/Makefile22
-rw-r--r--src/native/addrbook/msoutlook/MsOutlookMAPI.h10
-rw-r--r--src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp90
-rw-r--r--src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h19
-rw-r--r--src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp452
-rw-r--r--src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h29
-rw-r--r--src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c29
-rw-r--r--src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h29
8 files changed, 680 insertions, 0 deletions
diff --git a/src/native/addrbook/msoutlook/Makefile b/src/native/addrbook/msoutlook/Makefile
new file mode 100644
index 0000000..32d05f7
--- /dev/null
+++ b/src/native/addrbook/msoutlook/Makefile
@@ -0,0 +1,22 @@
+CXX = c++ -O2
+OUTLOOK_MAPI_HEADERS ?= /c/Users/lyubomir/Downloads/Outlook2010MAPIHeaders
+TARGET_BASENAME = jmsoutlook.dll
+
+ARCH = $(shell $(CXX) -dumpmachine | sed -e s/x86_64-.*/-64/ -e s/i.86-.*//)
+ifeq "$(ARCH)" "-64"
+ JAVA_HOME ?= C:/PROGRA~1/jdk
+else
+ JAVA_HOME ?= C:/PROGRA~2/jdk
+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)/jmsoutlookaddrbook.dll
+
+$(TARGET): \
+ MsOutlookMAPIHResultException.cpp \
+ 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/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp
new file mode 100644
index 0000000..115e6f0
--- /dev/null
+++ b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.cpp
@@ -0,0 +1,90 @@
+#include "MsOutlookMAPIHResultException.h"
+
+void
+MsOutlookMAPIHResultException_throwNew
+ (JNIEnv *jniEnv, HRESULT hResult, LPCTSTR file, ULONG line)
+{
+ jclass clazz;
+
+ clazz
+ = jniEnv->FindClass(
+ "net/java/sip/communicator/plugin/addrbook/msoutlook/MsOutlookMAPIHResultException");
+ if (clazz)
+ {
+ LPCTSTR message;
+
+ switch (hResult)
+ {
+ case MAPI_E_LOGON_FAILED:
+ message = _T("MAPI_E_LOGON_FAILED");
+ break;
+ case MAPI_E_NO_ACCESS:
+ message = _T("MAPI_E_NO_ACCESS");
+ break;
+ case MAPI_E_NOT_ENOUGH_MEMORY:
+ message = _T("MAPI_E_NOT_ENOUGH_MEMORY");
+ break;
+ case MAPI_E_NOT_FOUND:
+ message = _T("MAPI_E_NOT_FOUND");
+ break;
+ case MAPI_E_NOT_INITIALIZED:
+ message = _T("MAPI_E_NOT_INITIALIZED");
+ break;
+ case MAPI_E_TIMEOUT:
+ message = _T("MAPI_E_TIMEOUT");
+ break;
+ case MAPI_E_UNKNOWN_ENTRYID:
+ message = _T("MAPI_E_UNKNOWN_ENTRYID");
+ break;
+ case MAPI_E_USER_CANCEL:
+ message = _T("MAPI_E_USER_CANCEL");
+ break;
+ case MAPI_W_ERRORS_RETURNED:
+ message = _T("MAPI_W_ERRORS_RETURNED");
+ break;
+ case S_OK:
+ message = _T("S_OK");
+ break;
+ default:
+ message = NULL;
+ break;
+ }
+
+ if (message)
+ {
+ jmethodID methodID;
+
+ methodID
+ = jniEnv->GetMethodID(
+ clazz,
+ "<init>",
+ "(JLjava/lang/String;)V");
+ if (methodID)
+ {
+ jobject t;
+
+ t = jniEnv->NewObject(clazz, methodID, hResult, message);
+ if (t)
+ jniEnv->Throw((jthrowable) t);
+ return;
+ }
+ }
+
+ {
+ jmethodID methodID;
+
+ methodID = jniEnv->GetMethodID(clazz, "<init>", "(J)V");
+ if (methodID)
+ {
+ jobject t;
+
+ t = jniEnv->NewObject(clazz, methodID, hResult);
+ if (t)
+ jniEnv->Throw((jthrowable) t);
+ return;
+ }
+ }
+
+ jniEnv->ThrowNew(clazz, 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/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp
new file mode 100644
index 0000000..2c62b52
--- /dev/null
+++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp
@@ -0,0 +1,452 @@
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
+
+#include "MsOutlookMAPI.h"
+#include "MsOutlookMAPIHResultException.h"
+
+#include <string.h>
+
+#define WIND32_MEAN_AND_LEAK
+#include <windows.h>
+
+static void Exception_throwNew
+ (JNIEnv *jniEnv, const char *className, const char *message);
+
+static jboolean MsOutlookAddrBookContactQuery_foreachMailUser
+ (ULONG objType, LPUNKNOWN iUnknown,
+ JNIEnv *jniEnv,
+ jstring query,
+ jobject callback, jmethodID callbackMethodID);
+static jboolean MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable
+ (LPMAPICONTAINER mapiContainer, LPMAPITABLE mapiTable,
+ JNIEnv *jniEnv,
+ jstring query,
+ jobject callback, jmethodID callbackMethodID);
+static void MsOutlookAddrBookContactQuery_freeSRowSet(LPSRowSet rows);
+static jboolean MsOutlookAddrBookContactQuery_mailUserMatches
+ (LPMAPIPROP mailUser, JNIEnv *jniEnv, jstring query);
+
+static void
+Exception_throwNew(JNIEnv *jniEnv, const char *className, const char *message)
+{
+ jclass clazz;
+
+ clazz = jniEnv->FindClass(className);
+ if (clazz)
+ jniEnv->ThrowNew(clazz, message);
+}
+
+JNIEXPORT void JNICALL
+Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_foreachMailUser
+ (JNIEnv *jniEnv, jclass clazz, jstring query, jobject callback)
+{
+ jclass callbackClass;
+ jmethodID callbackMethodID;
+
+ HRESULT hResult;
+ LPMAPISESSION mapiSession;
+
+ /*
+ * Make sure that the specified arguments are valid. For example, check
+ * whether callback exists and has the necessary signature.
+ */
+ if (!callback)
+ {
+ Exception_throwNew(
+ jniEnv, "java/lang/NullPointerException", "callback");
+ return;
+ }
+ callbackClass = jniEnv->GetObjectClass(callback);
+ if (!callbackClass)
+ return;
+ callbackMethodID = jniEnv->GetMethodID(callbackClass, "callback", "(J)Z");
+ if (!callbackMethodID)
+ {
+ Exception_throwNew(
+ jniEnv, "java/lang/IllegalArgumentException", "callback");
+ return;
+ }
+
+ hResult
+ = MAPILogonEx(
+ 0,
+ NULL, NULL,
+ MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_USE_DEFAULT,
+ &mapiSession);
+ if (HR_SUCCEEDED(hResult))
+ {
+ LPADRBOOK adrBook;
+
+ hResult = mapiSession->OpenAddressBook(0, NULL, AB_NO_DIALOG, &adrBook);
+ if (HR_SUCCEEDED(hResult))
+ {
+ ULONG objType;
+ LPUNKNOWN iUnknown;
+
+ hResult = adrBook->OpenEntry(0, NULL, NULL, 0, &objType, &iUnknown);
+ if (HR_SUCCEEDED(hResult))
+ {
+ MsOutlookAddrBookContactQuery_foreachMailUser(
+ objType, iUnknown,
+ jniEnv, query, callback, callbackMethodID);
+
+ iUnknown->Release();
+ }
+ else
+ {
+ MsOutlookMAPIHResultException_throwNew(
+ jniEnv,
+ hResult,
+ __FILE__, __LINE__);
+ }
+
+ adrBook->Release();
+ }
+ else
+ {
+ MsOutlookMAPIHResultException_throwNew(
+ jniEnv,
+ hResult,
+ __FILE__, __LINE__);
+ }
+
+ mapiSession->Logoff(0, 0, 0);
+ mapiSession->Release();
+ }
+ else
+ {
+ MsOutlookMAPIHResultException_throwNew(
+ jniEnv,
+ hResult,
+ __FILE__, __LINE__);
+ }
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_IMAPIProp_1GetProps
+ (JNIEnv *jniEnv, jclass clazz,
+ jlong mapiProp, jlongArray propIds, jlong flags)
+{
+ jsize propIdCount;
+ LPSPropTagArray propTagArray;
+ jobjectArray props = NULL;
+
+ propIdCount = jniEnv->GetArrayLength(propIds);
+ if (S_OK
+ == MAPIAllocateBuffer(
+ CbNewSPropTagArray(propIdCount),
+ (void **) &propTagArray))
+ {
+ jsize i;
+
+ propTagArray->cValues = propIdCount;
+ for (i = 0; i < propIdCount; i++)
+ {
+ jlong propId;
+
+ jniEnv->GetLongArrayRegion(propIds, i, 1, &propId);
+ if (JNI_TRUE == jniEnv->ExceptionCheck())
+ {
+ MAPIFreeBuffer(propTagArray);
+ propTagArray = NULL;
+ break;
+ }
+ else
+ {
+ *(propTagArray->aulPropTag + i)
+ = PROP_TAG(PT_UNSPECIFIED, propId);
+ }
+ }
+ if (propTagArray)
+ {
+ HRESULT hResult;
+ ULONG propCount;
+ LPSPropValue propArray;
+
+ hResult
+ = ((LPMAPIPROP) mapiProp)->GetProps(
+ propTagArray,
+ (ULONG) flags,
+ &propCount, &propArray);
+ if (HR_SUCCEEDED(hResult))
+ {
+ jclass objectClass;
+ ULONG j;
+
+ objectClass = jniEnv->FindClass("java/lang/Object");
+ if (objectClass)
+ {
+ props
+ = jniEnv->NewObjectArray(
+ (jsize) propCount,
+ objectClass,
+ NULL);
+ }
+ for (j = 0; j < propCount; j++)
+ {
+ LPSPropValue prop = propArray;
+
+ if (props)
+ {
+ switch (PROP_TYPE(prop->ulPropTag))
+ {
+ case PT_STRING8:
+ {
+ jstring value;
+
+ value = jniEnv->NewStringUTF(prop->Value.lpszA);
+ if (value)
+ {
+ jniEnv->SetObjectArrayElement(props, j, value);
+ if (jniEnv->ExceptionCheck())
+ props = NULL;
+ }
+ break;
+ }
+
+ case PT_UNICODE:
+ {
+ jstring value;
+
+ value
+ = jniEnv->NewString(
+ (const jchar *) (prop->Value.lpszW),
+ wcslen(prop->Value.lpszW));
+ if (value)
+ {
+ jniEnv->SetObjectArrayElement(props, j, value);
+ if (jniEnv->ExceptionCheck())
+ props = NULL;
+ }
+ break;
+ }
+ }
+ }
+ MAPIFreeBuffer(prop);
+ propArray++;
+ }
+ }
+ else
+ {
+ MsOutlookMAPIHResultException_throwNew(
+ jniEnv,
+ hResult,
+ __FILE__, __LINE__);
+ }
+ MAPIFreeBuffer(propTagArray);
+ }
+ }
+ else
+ {
+ MsOutlookMAPIHResultException_throwNew(
+ jniEnv,
+ MAPI_E_NOT_ENOUGH_MEMORY,
+ __FILE__, __LINE__);
+ }
+ return props;
+}
+
+static jboolean
+MsOutlookAddrBookContactQuery_foreachMailUser
+ (ULONG objType, LPUNKNOWN iUnknown,
+ JNIEnv *jniEnv,
+ jstring query,
+ jobject callback, jmethodID callbackMethodID)
+{
+ jboolean proceed;
+
+ switch (objType)
+ {
+ case MAPI_ABCONT:
+ {
+ LPMAPICONTAINER mapiContainer = (LPMAPICONTAINER) iUnknown;
+
+ HRESULT hResult;
+ LPMAPITABLE mapiTable;
+
+ proceed = JNI_TRUE;
+
+ /* Look for MAPI_MAILUSER through the contents. */
+ mapiTable = NULL;
+ hResult = mapiContainer->GetContentsTable(0, &mapiTable);
+ if (HR_SUCCEEDED(hResult) && mapiTable)
+ {
+ proceed
+ = MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable(
+ mapiContainer, mapiTable,
+ jniEnv, query, callback, callbackMethodID);
+ mapiTable->Release();
+ }
+
+ /* Drill down the hierarchy. */
+ if (JNI_TRUE == proceed)
+ {
+ mapiTable = NULL;
+ hResult = mapiContainer->GetHierarchyTable(0, &mapiTable);
+ if (HR_SUCCEEDED(hResult) && mapiTable)
+ {
+ proceed
+ = MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable(
+ mapiContainer, mapiTable,
+ jniEnv, query, callback, callbackMethodID);
+ mapiTable->Release();
+ }
+ }
+
+ break;
+ }
+
+ case MAPI_MAILUSER:
+ {
+ if (JNI_TRUE
+ == MsOutlookAddrBookContactQuery_mailUserMatches(
+ (LPMAPIPROP) iUnknown,
+ jniEnv, query))
+ {
+ /* Report the MAPI_MAILUSER to the callback. */
+ proceed
+ = jniEnv->CallBooleanMethod(
+ callback, callbackMethodID,
+ iUnknown);
+ /*
+ * XXX When an exception is thrown in the callback, does proceed get
+ * assigned JNI_FALSE?
+ */
+ if ((JNI_TRUE == proceed) && (JNI_TRUE == jniEnv->ExceptionCheck()))
+ proceed = JNI_FALSE;
+ }
+ else
+ proceed = JNI_TRUE;
+ break;
+ }
+ }
+ return proceed;
+}
+
+static jboolean
+MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable
+ (LPMAPICONTAINER mapiContainer, LPMAPITABLE mapiTable,
+ JNIEnv *jniEnv,
+ jstring query,
+ jobject callback, jmethodID callbackMethodID)
+{
+ HRESULT hResult;
+ jboolean proceed;
+
+ hResult = mapiTable->SeekRow(BOOKMARK_BEGINNING, 0, NULL);
+ if (HR_SUCCEEDED(hResult))
+ {
+ LPSRowSet rows;
+
+ proceed = JNI_TRUE;
+ while ((JNI_TRUE == proceed)
+ && HR_SUCCEEDED(hResult = mapiTable->QueryRows(1, 0, &rows)))
+ {
+ if (rows->cRows == 1)
+ {
+ ULONG i;
+ LPSRow row = rows->aRow;
+ ULONG objType = 0;
+ SBinary entryIDBinary = {0, NULL};
+
+ for (i = 0; i < row->cValues; i++)
+ {
+ LPSPropValue prop = (row->lpProps) + i;
+
+ switch (prop->ulPropTag)
+ {
+ case PR_OBJECT_TYPE:
+ objType = prop->Value.ul;
+ break;
+ case PR_ENTRYID:
+ entryIDBinary = prop->Value.bin;
+ break;
+ }
+ }
+
+ if (objType && entryIDBinary.cb && entryIDBinary.lpb)
+ {
+ LPENTRYID entryID;
+
+ if (S_OK
+ == MAPIAllocateBuffer(
+ entryIDBinary.cb,
+ (void **) &entryID))
+ {
+ LPUNKNOWN iUnknown;
+
+ CopyMemory(
+ entryID,
+ entryIDBinary.lpb,
+ entryIDBinary.cb);
+
+ /*
+ * We no longer need the rows at this point so free them
+ * before we drill down the hierarchy and allocate even more rows.
+ */
+ MsOutlookAddrBookContactQuery_freeSRowSet(rows);
+
+ hResult
+ = mapiContainer->OpenEntry(
+ entryIDBinary.cb, entryID,
+ NULL,
+ 0,
+ &objType, &iUnknown);
+ if (HR_SUCCEEDED(hResult))
+ {
+ proceed
+ = MsOutlookAddrBookContactQuery_foreachMailUser(
+ objType, iUnknown,
+ jniEnv, query, callback, callbackMethodID);
+ iUnknown->Release();
+ }
+
+ MAPIFreeBuffer(entryID);
+ }
+ else
+ MsOutlookAddrBookContactQuery_freeSRowSet(rows);
+ }
+ else
+ MsOutlookAddrBookContactQuery_freeSRowSet(rows);
+ }
+ else
+ {
+ MAPIFreeBuffer(rows);
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* We've failed but other parts of the hierarchy may still succeed. */
+ proceed = JNI_TRUE;
+ }
+ return proceed;
+}
+
+static void
+MsOutlookAddrBookContactQuery_freeSRowSet(LPSRowSet rows)
+{
+ ULONG i;
+
+ for (i = 0; i < rows->cRows; i++)
+ {
+ LPSRow row = (rows->aRow) + i;
+ ULONG j;
+
+ for (j = 0; j < row->cValues; j++)
+ {
+ LPSPropValue prop = (row->lpProps) + j;
+
+ MAPIFreeBuffer(prop);
+ }
+ }
+ MAPIFreeBuffer(rows);
+}
+
+static jboolean
+MsOutlookAddrBookContactQuery_mailUserMatches
+ (LPMAPIPROP mailUser, JNIEnv *jniEnv, jstring query)
+{
+ // TODO Auto-generated method stub
+ return JNI_TRUE;
+}
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/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c
new file mode 100644
index 0000000..10a82c2
--- /dev/null
+++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c
@@ -0,0 +1,29 @@
+#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_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIInitialize
+ (JNIEnv *jniEnv, jclass clazz, jlong version, jlong flags)
+{
+ MAPIINIT_0 mapiInit = { (ULONG) version, (ULONG) flags };
+ HRESULT hResult;
+
+ hResult = MAPIInitialize(&mapiInit);
+
+ if (HR_FAILED(hResult))
+ {
+ MsOutlookMAPIHResultException_throwNew(
+ jniEnv,
+ hResult,
+ __FILE__, __LINE__);
+ }
+}
+
+JNIEXPORT void JNICALL
+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