aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2014-03-24 10:55:37 +0200
committerDamian Minkov <damencho@jitsi.org>2014-03-24 10:56:49 +0200
commitb035911232492e3bbf6e55b6e03087576e0010b6 (patch)
tree9b7ca2de192e90a36c153f6e616daf0d3c65b2c7 /src/native
parent1cc5494e9adf6fb25acfa69cfa1e586866549b9a (diff)
downloadjitsi-b035911232492e3bbf6e55b6e03087576e0010b6.zip
jitsi-b035911232492e3bbf6e55b6e03087576e0010b6.tar.gz
jitsi-b035911232492e3bbf6e55b6e03087576e0010b6.tar.bz2
Fixes canceling outlook queries when new one is created and uses one remote object to deliver results from com server, instead of creating new one for every contact. Adds some measurement trace prints, that can track execution time of native part.
Diffstat (limited to 'src/native')
-rw-r--r--src/native/addrbook/msoutlook/MAPINotification.cxx11
-rw-r--r--src/native/addrbook/msoutlook/MAPINotification.h2
-rw-r--r--src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx121
-rw-r--r--src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.h7
-rw-r--r--src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h16
-rw-r--r--src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl3
-rw-r--r--src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlbbin1860 -> 1892 bytes
-rw-r--r--src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.h16
-rw-r--r--src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.idl3
-rw-r--r--src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.tlbbin2572 -> 2604 bytes
-rw-r--r--src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx10
-rw-r--r--src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h3
-rw-r--r--src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx47
-rw-r--r--src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.h5
-rw-r--r--src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx2
-rw-r--r--src/native/build.xml5
16 files changed, 173 insertions, 78 deletions
diff --git a/src/native/addrbook/msoutlook/MAPINotification.cxx b/src/native/addrbook/msoutlook/MAPINotification.cxx
index bdbfccf..d2f2422 100644
--- a/src/native/addrbook/msoutlook/MAPINotification.cxx
+++ b/src/native/addrbook/msoutlook/MAPINotification.cxx
@@ -68,9 +68,9 @@ LONG STDAPICALLTYPE MAPINotification_tableChanged
* @return True everything works fine and that we must continue to list the
* other contacts. False otherwise.
*/
-boolean MAPINotification_callCallbackMethod(LPSTR iUnknown, void * object)
+boolean MAPINotification_callCallbackMethod(LPSTR iUnknown, long objectAddr)
{
- if(object == NULL)
+ if(objectAddr <= 0)
{
MAPINotification_jniCallInsertedMethod(iUnknown);
return true;
@@ -82,9 +82,10 @@ boolean MAPINotification_callCallbackMethod(LPSTR iUnknown, void * object)
if(MAPINotification_VM
->AttachCurrentThreadAsDaemon((void**) &tmpJniEnv, NULL) == 0)
{
- if(object != NULL)
+ if(objectAddr > 0)
{
- jclass callbackClass = tmpJniEnv->GetObjectClass((jobject) object);
+ jobject object = (jobject)(intptr_t)objectAddr;
+ jclass callbackClass = tmpJniEnv->GetObjectClass(object);
if(callbackClass)
{
jmethodID ptrOutlookContactCallbackMethodIdCallback
@@ -99,7 +100,7 @@ boolean MAPINotification_callCallbackMethod(LPSTR iUnknown, void * object)
// Report the MAPI_MAILUSER to the callback.
proceed = tmpJniEnv->CallBooleanMethod(
- (jobject) object,
+ object,
ptrOutlookContactCallbackMethodIdCallback,
value);
}
diff --git a/src/native/addrbook/msoutlook/MAPINotification.h b/src/native/addrbook/msoutlook/MAPINotification.h
index f2a81fc..f1517d7 100644
--- a/src/native/addrbook/msoutlook/MAPINotification.h
+++ b/src/native/addrbook/msoutlook/MAPINotification.h
@@ -23,7 +23,7 @@ extern "C" {
* @author Vincent Lucas
*/
-boolean MAPINotification_callCallbackMethod(LPSTR iUnknown, void * object);
+boolean MAPINotification_callCallbackMethod(LPSTR iUnknown, long objectAddr);
void MAPINotification_jniCallDeletedMethod(LPSTR iUnknown);
void MAPINotification_jniCallInsertedMethod(LPSTR iUnknown);
diff --git a/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx b/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx
index f37cdf4..d24b305 100644
--- a/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx
+++ b/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx
@@ -47,7 +47,10 @@ typedef
jboolean (*MsOutlookAddrBookContactQuery_ForeachRowInTableCallback)
(LPUNKNOWN iUnknown,
ULONG entryIDByteCount, LPENTRYID entryID, ULONG objType,
- const char * query, void * callback, void * callbackObject);
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
static ULONG MsOutlookAddrBookContactQuery_rdOpenEntryUlFlags = 0x0;
static ULONG MsOutlookAddrBookContactQuery_rwOpenEntryUlFlags
@@ -65,18 +68,27 @@ HRESULT MsOutlookAddrBookContactQuery_createEmailAddress
LONG providerArrayType, ULONG propIds[], int nbPropId);
static jboolean MsOutlookAddrBookContactQuery_foreachContactInMsgStoresTable
(LPMAPISESSION mapiSession, const char * query,
- void * callback, void * callbackObject);
+ void * callbackMethod, void * callbackClient, long callbackAddress);
static jboolean MsOutlookAddrBookContactQuery_foreachMailUser
(ULONG objType, LPUNKNOWN iUnknown,
- const char * query, void * callback, void * callbackObject);
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
static jboolean MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable
(LPMAPICONTAINER mapiContainer, LPMAPITABLE mapiTable,
- const char * query, void * callback, void * callbackObject);
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
static jboolean MsOutlookAddrBookContactQuery_foreachRowInTable
(LPMAPITABLE mapiTable,
MsOutlookAddrBookContactQuery_ForeachRowInTableCallback rowCallback,
LPUNKNOWN iUnknown,
- const char * query, void * callback, void * callbackObject);
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
static void MsOutlookAddrBookContactQuery_freeSRowSet(LPSRowSet rows);
static void* MsOutlookAddrBookContactQuery_getAttachmentContactPhoto
(LPMESSAGE message, ULONGLONG * length);
@@ -100,11 +112,17 @@ static jboolean MsOutlookAddrBookContactQuery_mailUserMatches
static jboolean MsOutlookAddrBookContactQuery_onForeachContactInMsgStoresTableRow
(LPUNKNOWN mapiSession,
ULONG entryIDByteCount, LPENTRYID entryID, ULONG objType,
- const char * query, void * callback, void * callbackObject);
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
static jboolean MsOutlookAddrBookContactQuery_onForeachMailUserInContainerTableRow
(LPUNKNOWN mapiContainer,
ULONG entryIDByteCount, LPENTRYID entryID, ULONG objType,
- const char * query, void * callback, void * callbackObject);
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
LPUNKNOWN MsOutlookAddrBookContactQuery_openEntryId
(ULONG entryIdSize, LPENTRYID entryId, ULONG flags);
LPUNKNOWN MsOutlookAddrBookContactQuery_openEntryIdStr
@@ -395,30 +413,40 @@ int MsOutlookAddrBookContactQuery_deleteContact(const char * nativeEntryId)
return res;
}
-void MsOutlookAddrBookContactQuery_foreachMailUser(
- const char * query, void * callback, void * callbackObject)
+HRESULT MsOutlookAddrBookContactQuery_foreachMailUser(
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
MAPISession_lock();
LPMAPISESSION mapiSession = MAPISession_getMapiSession();
if (!mapiSession)
{
MAPISession_unlock();
- return;
+ return E_ABORT;
}
- MsOutlookAddrBookContactQuery_foreachContactInMsgStoresTable(
+ boolean proceed =
+ MsOutlookAddrBookContactQuery_foreachContactInMsgStoresTable(
mapiSession,
query,
- callback,
- callbackObject);
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
MAPISession_unlock();
+
+ return proceed ? S_OK : E_ABORT;
}
static jboolean
MsOutlookAddrBookContactQuery_foreachContactInMsgStoresTable
(LPMAPISESSION mapiSession,
- const char * query, void * callback, void * callbackObject)
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
HRESULT hResult;
LPMAPITABLE msgStoresTable = NULL;
@@ -432,7 +460,10 @@ MsOutlookAddrBookContactQuery_foreachContactInMsgStoresTable
msgStoresTable,
MsOutlookAddrBookContactQuery_onForeachContactInMsgStoresTableRow,
(LPUNKNOWN) mapiSession,
- query, callback, callbackObject);
+ query,
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
msgStoresTable->Release();
}
@@ -442,7 +473,10 @@ MsOutlookAddrBookContactQuery_foreachContactInMsgStoresTable
static jboolean
MsOutlookAddrBookContactQuery_foreachMailUser
(ULONG objType, LPUNKNOWN iUnknown,
- const char * query, void * callback, void * callbackObject)
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
jboolean proceed = JNI_TRUE;
@@ -464,7 +498,10 @@ MsOutlookAddrBookContactQuery_foreachMailUser
proceed
= MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable(
mapiContainer, mapiTable,
- query, callback, callbackObject);
+ query,
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
mapiTable->Release();
}
@@ -478,7 +515,10 @@ MsOutlookAddrBookContactQuery_foreachMailUser
proceed
= MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable(
mapiContainer, mapiTable,
- query, callback, callbackObject);
+ query,
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
mapiTable->Release();
}
}
@@ -495,8 +535,9 @@ MsOutlookAddrBookContactQuery_foreachMailUser
LPSTR contactId = MsOutlookAddrBookContactQuery_getContactId(
(LPMAPIPROP) iUnknown);
- boolean(*cb)(LPSTR, void*) = (boolean(*)(LPSTR, void*)) callback;
- proceed = cb(contactId, callbackObject);
+ boolean(*cb)(LPSTR, void *, long)
+ = (boolean(*)(LPSTR, void *, long)) callbackMethod;
+ proceed = cb(contactId, callbackClient, callbackAddress);
::free(contactId);
contactId = NULL;
@@ -510,14 +551,20 @@ MsOutlookAddrBookContactQuery_foreachMailUser
static jboolean
MsOutlookAddrBookContactQuery_foreachMailUserInContainerTable
(LPMAPICONTAINER mapiContainer, LPMAPITABLE mapiTable,
- const char * query, void * callback, void * callbackObject)
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
return
MsOutlookAddrBookContactQuery_foreachRowInTable(
mapiTable,
MsOutlookAddrBookContactQuery_onForeachMailUserInContainerTableRow,
(LPUNKNOWN) mapiContainer,
- query, callback, callbackObject);
+ query,
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
}
static jboolean
@@ -525,7 +572,10 @@ MsOutlookAddrBookContactQuery_foreachRowInTable
(LPMAPITABLE mapiTable,
MsOutlookAddrBookContactQuery_ForeachRowInTableCallback rowCallback,
LPUNKNOWN iUnknown,
- const char * query, void * callback, void * callbackObject)
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
HRESULT hResult;
// In case, that we have failed but other parts of the hierarchy may still
@@ -590,7 +640,10 @@ MsOutlookAddrBookContactQuery_foreachRowInTable
= rowCallback(
iUnknown,
entryIDBinary.cb, entryID, objType,
- query, callback, callbackObject);
+ query,
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
MAPIFreeBuffer(entryID);
}
@@ -1558,7 +1611,10 @@ static jboolean
MsOutlookAddrBookContactQuery_onForeachContactInMsgStoresTableRow
(LPUNKNOWN mapiSession,
ULONG entryIDByteCount, LPENTRYID entryID, ULONG objType,
- const char * query, void * callback, void * callbackObject)
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
HRESULT hResult;
LPMDB msgStore;
@@ -1623,8 +1679,9 @@ MsOutlookAddrBookContactQuery_onForeachContactInMsgStoresTableRow
contactsFolderObjType,
contactsFolder,
query,
- callback,
- callbackObject);
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
contactsFolder->Release();
}
MAPIFreeBuffer(contactsFolderEntryID);
@@ -1639,7 +1696,10 @@ static jboolean
MsOutlookAddrBookContactQuery_onForeachMailUserInContainerTableRow
(LPUNKNOWN mapiContainer,
ULONG entryIDByteCount, LPENTRYID entryID, ULONG objType,
- const char * query, void * callback, void * callbackObject)
+ const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress)
{
HRESULT hResult;
LPUNKNOWN iUnknown;
@@ -1659,8 +1719,9 @@ MsOutlookAddrBookContactQuery_onForeachMailUserInContainerTableRow
objType,
iUnknown,
query,
- callback,
- callbackObject);
+ callbackMethod,
+ callbackClient,
+ callbackAddress);
iUnknown->Release();
}
else
diff --git a/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.h b/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.h
index cdc36d5..99fd749 100644
--- a/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.h
+++ b/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.h
@@ -28,8 +28,11 @@ char* MsOutlookAddrBookContactQuery_createContact(void);
int MsOutlookAddrBookContactQuery_deleteContact(const char * nativeEntryId);
-void MsOutlookAddrBookContactQuery_foreachMailUser
- (const char * query, void * callback, void * callbackObject);
+HRESULT MsOutlookAddrBookContactQuery_foreachMailUser
+ (const char * query,
+ void * callbackMethod,
+ void * callbackClient,
+ long callbackAddress);
char* MsOutlookAddrBookContactQuery_getStringUnicodeProp
(LPUNKNOWN entry, ULONG propId);
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h
index b8eed7e..4337015 100644
--- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h
+++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h
@@ -3,11 +3,11 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
- /* File created by MIDL compiler version 8.00.0595 */
-/* at Tue May 07 03:41:40 2013
+ /* File created by MIDL compiler version 8.00.0603 */
+/* at Mon Mar 24 09:03:06 2014
*/
/* Compiler settings for IMsOutlookAddrBookClient.idl:
- Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
+ Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
@@ -84,7 +84,8 @@ EXTERN_C const IID IID_IMsOutlookAddrBookClient;
{
public:
virtual HRESULT STDMETHODCALLTYPE foreachMailUserCallback(
- /* [in] */ BSTR id) = 0;
+ /* [in] */ BSTR id,
+ /* [in] */ long callback) = 0;
virtual HRESULT STDMETHODCALLTYPE deleted(
/* [in] */ BSTR id) = 0;
@@ -118,7 +119,8 @@ EXTERN_C const IID IID_IMsOutlookAddrBookClient;
HRESULT ( STDMETHODCALLTYPE *foreachMailUserCallback )(
IMsOutlookAddrBookClient * This,
- /* [in] */ BSTR id);
+ /* [in] */ BSTR id,
+ /* [in] */ long callback);
HRESULT ( STDMETHODCALLTYPE *deleted )(
IMsOutlookAddrBookClient * This,
@@ -155,8 +157,8 @@ EXTERN_C const IID IID_IMsOutlookAddrBookClient;
( (This)->lpVtbl -> Release(This) )
-#define IMsOutlookAddrBookClient_foreachMailUserCallback(This,id) \
- ( (This)->lpVtbl -> foreachMailUserCallback(This,id) )
+#define IMsOutlookAddrBookClient_foreachMailUserCallback(This,id,callback) \
+ ( (This)->lpVtbl -> foreachMailUserCallback(This,id,callback) )
#define IMsOutlookAddrBookClient_deleted(This,id) \
( (This)->lpVtbl -> deleted(This,id) )
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl
index bf3450b..6e1fad5 100644
--- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl
+++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl
@@ -10,7 +10,8 @@ import "Unknwn.idl", "oaidl.idl";
interface IMsOutlookAddrBookClient : IUnknown
{
HRESULT foreachMailUserCallback(
- [in] BSTR id);
+ [in] BSTR id,
+ [in] long callback);
HRESULT deleted(
[in] BSTR id);
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb
index 716c3aa..168d9ad 100644
--- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb
+++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb
Binary files differ
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.h b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.h
index 0cf23fa..aee8983 100644
--- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.h
+++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.h
@@ -3,11 +3,11 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
- /* File created by MIDL compiler version 8.00.0595 */
-/* at Wed Jun 19 15:47:56 2013
+ /* File created by MIDL compiler version 8.00.0603 */
+/* at Mon Mar 24 09:03:14 2014
*/
/* Compiler settings for IMsOutlookAddrBookServer.idl:
- Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
+ Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
@@ -84,7 +84,8 @@ EXTERN_C const IID IID_IMsOutlookAddrBookServer;
{
public:
virtual HRESULT STDMETHODCALLTYPE foreachMailUser(
- /* [in] */ BSTR query) = 0;
+ /* [in] */ BSTR query,
+ /* [in] */ long callback) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_GetProps(
/* [in] */ BSTR entryId,
@@ -138,7 +139,8 @@ EXTERN_C const IID IID_IMsOutlookAddrBookServer;
HRESULT ( STDMETHODCALLTYPE *foreachMailUser )(
IMsOutlookAddrBookServer * This,
- /* [in] */ BSTR query);
+ /* [in] */ BSTR query,
+ /* [in] */ long callback);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_GetProps )(
IMsOutlookAddrBookServer * This,
@@ -198,8 +200,8 @@ EXTERN_C const IID IID_IMsOutlookAddrBookServer;
( (This)->lpVtbl -> Release(This) )
-#define IMsOutlookAddrBookServer_foreachMailUser(This,query) \
- ( (This)->lpVtbl -> foreachMailUser(This,query) )
+#define IMsOutlookAddrBookServer_foreachMailUser(This,query,callback) \
+ ( (This)->lpVtbl -> foreachMailUser(This,query,callback) )
#define IMsOutlookAddrBookServer_IMAPIProp_GetProps(This,entryId,nbPropIds,propIds,flags,props,propsLength,propsType) \
( (This)->lpVtbl -> IMAPIProp_GetProps(This,entryId,nbPropIds,propIds,flags,props,propsLength,propsType) )
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.idl b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.idl
index 354c947..5fbaffa 100644
--- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.idl
+++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.idl
@@ -10,7 +10,8 @@ import "Unknwn.idl", "oaidl.idl";
interface IMsOutlookAddrBookServer : IUnknown
{
HRESULT foreachMailUser(
- [in] BSTR query);
+ [in] BSTR query,
+ [in] long callback);
HRESULT IMAPIProp_GetProps(
[in] BSTR entryId,
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.tlb b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.tlb
index a653c05..9492af3 100644
--- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.tlb
+++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookServer.tlb
Binary files differ
diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx
index 8ae23fb..b21a636 100644
--- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx
+++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx
@@ -100,17 +100,21 @@ STDMETHODIMP_(ULONG) MsOutlookAddrBookClient::Release()
* a search via the foreachMailUser function.
*
* @param id The contact identifier.
+ * @param callback the callback address
*
* @return S_OK.
*/
HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::foreachMailUserCallback(
- BSTR id)
+ BSTR id, long callback)
{
char * charId = StringUtils::WideCharToMultiByte(id);
- MAPINotification_callCallbackMethod(charId, NULL);
+ boolean res = MAPINotification_callCallbackMethod(charId, callback);
free(charId);
- return S_OK;
+ if(res)
+ return S_OK;
+ else
+ return E_ABORT;
}
/**
diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h
index f21b3c4..159e0f8 100644
--- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h
+++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h
@@ -35,7 +35,8 @@ class MsOutlookAddrBookClient:
STDMETHODIMP_(ULONG) Release();
// IMsOutlookAddrBookClient
- HRESULT STDMETHODCALLTYPE foreachMailUserCallback(BSTR id);
+ HRESULT STDMETHODCALLTYPE foreachMailUserCallback(
+ BSTR id, long callback);
HRESULT STDMETHODCALLTYPE deleted(BSTR id);
HRESULT STDMETHODCALLTYPE inserted(BSTR id);
diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx
index 1d3d362..f80b60b 100644
--- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx
+++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx
@@ -101,54 +101,67 @@ STDMETHODIMP_(ULONG) MsOutlookAddrBookServer::Release()
* Starts a search for contact using MAPI.A
*
* @param query The search pattern (unused).
+ * @param callbackAddress The address of the callback.
*
* @return S_OK.
*/
-HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::foreachMailUser(BSTR query)
+HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::foreachMailUser(
+ BSTR query, long callbackAddress)
{
char * charQuery = StringUtils::WideCharToMultiByte(query);
- MsOutlookAddrBookContactQuery_foreachMailUser(
- charQuery,
- (void *) MsOutlookAddrBookServer::foreachMailUserCallback,
- NULL);
+ HRESULT hr = E_FAIL;
+
+ IMsOutlookAddrBookClient * msOutlookAddrBookClient = NULL;
+ if((hr = CoCreateInstance(
+ CLSID_MsOutlookAddrBookClient,
+ NULL,
+ CLSCTX_LOCAL_SERVER,
+ IID_IMsOutlookAddrBookClient,
+ (void**) &msOutlookAddrBookClient)) == S_OK)
+ {
+ hr = MsOutlookAddrBookContactQuery_foreachMailUser(
+ charQuery,
+ (void *) MsOutlookAddrBookServer::foreachMailUserCallback,
+ (void *) msOutlookAddrBookClient,
+ callbackAddress);
+
+ msOutlookAddrBookClient->Release();
+ }
free(charQuery);
- return S_OK;
+ return hr == S_OK;
}
/**
* Calls back the java side to list a contact.
*
* @param iUnknown The string representation of the entry id of the contact.
- * @param object Not used. Must be set to NULL.
+ * @param callbackClient the client object to call the callback and pass the
+ * result and the callbackAddress we have received.
+ * @param callbackAddress the address of the callback function.
*
* @return True everything works fine and that we must continue to list the
* other contacts. False otherwise.
*/
boolean MsOutlookAddrBookServer::foreachMailUserCallback(
LPSTR iUnknown,
- void * object)
+ void * callbackClient,
+ long callbackAddress)
{
HRESULT hr = E_FAIL;
- IMsOutlookAddrBookClient * msOutlookAddrBookClient = NULL;
- if((hr = CoCreateInstance(
- CLSID_MsOutlookAddrBookClient,
- NULL,
- CLSCTX_LOCAL_SERVER,
- IID_IMsOutlookAddrBookClient,
- (void**) &msOutlookAddrBookClient)) == S_OK)
+ if(callbackClient)
{
LPWSTR iUnknownW = StringUtils::MultiByteToWideChar(iUnknown);
BSTR res = SysAllocString(iUnknownW);
- hr = msOutlookAddrBookClient->foreachMailUserCallback(res);
+ hr = ((IMsOutlookAddrBookClient *)callbackClient)
+ ->foreachMailUserCallback(res, callbackAddress);
SysFreeString(res);
free(iUnknownW);
- msOutlookAddrBookClient->Release();
}
return (hr == S_OK);
diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.h b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.h
index a1ba304..190217a 100644
--- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.h
+++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.h
@@ -35,7 +35,7 @@ class MsOutlookAddrBookServer:
STDMETHODIMP_(ULONG) Release();
// IMsOutlookAddrBookServer
- HRESULT STDMETHODCALLTYPE foreachMailUser(BSTR query);
+ HRESULT STDMETHODCALLTYPE foreachMailUser(BSTR query, long callback);
HRESULT STDMETHODCALLTYPE IMAPIProp_GetProps(
BSTR entryId,
@@ -74,7 +74,8 @@ class MsOutlookAddrBookServer:
static boolean foreachMailUserCallback(
LPSTR iUnknown,
- void * object);
+ void * callbackClient,
+ long callbackAddress);
};
#endif
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx
index fa81c62..9e34c65 100644
--- a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx
+++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx
@@ -100,7 +100,7 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac
LPWSTR unicodeQuery = StringUtils::MultiByteToWideChar(nativeQuery);
BSTR comQuery = SysAllocString(unicodeQuery);
- iServer->foreachMailUser(comQuery);
+ iServer->foreachMailUser(comQuery, (long)(intptr_t)callback);
SysFreeString(comQuery);
free(unicodeQuery);
}
diff --git a/src/native/build.xml b/src/native/build.xml
index a5697e4..fbed1ff 100644
--- a/src/native/build.xml
+++ b/src/native/build.xml
@@ -824,6 +824,11 @@
</target>
<!-- compile jmsoutlookaddrbook library for Windows -->
+ <!-- install tdm-gcc both 32 and 64 bit with command line tools and
+ can directly use command prompt
+ When changing idl file in visual studio console execute
+ midl <idl file>.
+ -->
<target
name="msoutlookaddrbook"
description="Build jmsoutlookaddrbook shared library for Windows"