aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/addrbook/msoutlook
diff options
context:
space:
mode:
Diffstat (limited to 'src/native/addrbook/msoutlook')
-rw-r--r--src/native/addrbook/msoutlook/Makefile7
-rw-r--r--src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp37
2 files changed, 8 insertions, 36 deletions
diff --git a/src/native/addrbook/msoutlook/Makefile b/src/native/addrbook/msoutlook/Makefile
index 32d05f7..53e108c 100644
--- a/src/native/addrbook/msoutlook/Makefile
+++ b/src/native/addrbook/msoutlook/Makefile
@@ -1,6 +1,6 @@
CXX = c++ -O2
OUTLOOK_MAPI_HEADERS ?= /c/Users/lyubomir/Downloads/Outlook2010MAPIHeaders
-TARGET_BASENAME = jmsoutlook.dll
+TARGET_BASENAME = jmsoutlookaddrbook
ARCH = $(shell $(CXX) -dumpmachine | sed -e s/x86_64-.*/-64/ -e s/i.86-.*//)
ifeq "$(ARCH)" "-64"
@@ -9,12 +9,13 @@ else
JAVA_HOME ?= C:/PROGRA~2/jdk
endif
-CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(OUTLOOK_MAPI_HEADERS)
+CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(OUTLOOK_MAPI_HEADERS) -I..
LDFLAGS = -shared -Wl,--kill-at
LIBS = -lmapi32
-TARGET = ../../../../lib/native/windows$(ARCH)/jmsoutlookaddrbook.dll
+TARGET = ../../../../lib/native/windows$(ARCH)/$(TARGET_BASENAME).dll
$(TARGET): \
+ ../AddrBookContactQuery.c
MsOutlookMAPIHResultException.cpp \
net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cpp \
net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.c
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
index 033d297..f238e19 100644
--- 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
@@ -7,6 +7,7 @@
#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
+#include "AddrBookContactQuery.h"
#include "MsOutlookMAPI.h"
#include "MsOutlookMAPIHResultException.h"
@@ -15,9 +16,6 @@
#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,
@@ -32,46 +30,19 @@ 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)
+ callbackMethodID
+ = AddrBookContactQuery_getPtrCallbackMethodID(jniEnv, callback);
+ if (!callbackMethodID || (JNI_TRUE == jniEnv->ExceptionCheck()))
return;
- callbackMethodID = jniEnv->GetMethodID(callbackClass, "callback", "(J)Z");
- if (!callbackMethodID)
- {
- Exception_throwNew(
- jniEnv, "java/lang/IllegalArgumentException", "callback");
- return;
- }
hResult
= MAPILogonEx(