diff options
author | hristoterezov <hristo@jitsi.org> | 2014-05-09 12:25:39 +0300 |
---|---|---|
committer | hristoterezov <hristo@jitsi.org> | 2014-05-09 12:25:39 +0300 |
commit | b2d44ec255747e377283e97188aa102539d2b3d6 (patch) | |
tree | 52bef3c93ef184aad1729ead26301609e3bce943 /src/native | |
parent | 06f5034c92409252a9f46db88d63486dc92fffa0 (diff) | |
download | jitsi-b2d44ec255747e377283e97188aa102539d2b3d6.zip jitsi-b2d44ec255747e377283e97188aa102539d2b3d6.tar.gz jitsi-b2d44ec255747e377283e97188aa102539d2b3d6.tar.bz2 |
Fixes the issue with changing the presence status to "In a meeting" from
not accepted calendar items. Fixes MAPI notifications to notify only for
items from the calendar folders or contacts folders. Separates the
contacts notifications from calendar notifications in the native code.
Diffstat (limited to 'src/native')
14 files changed, 659 insertions, 300 deletions
diff --git a/src/native/addrbook/msoutlook/MAPINotification.cxx b/src/native/addrbook/msoutlook/MAPINotification.cxx index bdb78c5..13b3449 100644 --- a/src/native/addrbook/msoutlook/MAPINotification.cxx +++ b/src/native/addrbook/msoutlook/MAPINotification.cxx @@ -12,6 +12,7 @@ #include "MsOutlookAddrBookContactSourceService.h" #include "MsOutlookAddrBookContactQuery.h" #include "MsOutlookUtils.h" +#include "MsOutlookCalendar.h" #include <mapidefs.h> #include <stdio.h> @@ -37,6 +38,8 @@ static ULONG MAPINotification_EVENT_MASK static LPMDB * MAPINotification_msgStores = NULL; static LPMAPIADVISESINK * MAPINotification_adviseSinks = NULL; static ULONG * MAPINotification_msgStoresConnection = NULL; +static LPMAPIADVISESINK * MAPINotification_calendarAdviseSinks = NULL; +static ULONG * MAPINotification_calendarMsgStoresConnection = NULL; static LPMAPITABLE MAPINotification_msgStoresTable = NULL; static LPMAPIADVISESINK MAPINotification_msgStoresTableAdviseSink = NULL; static ULONG MAPINotification_msgStoresTableConnection = 0; @@ -62,8 +65,14 @@ void (*MAPINotification_callCalendarDeletedMethod)(LPSTR iUnknown) = NULL; void (*MAPINotification_callCalendarInsertedMethod)(LPSTR iUnknown) = NULL; void (*MAPINotification_callCalendarUpdatedMethod)(LPSTR iUnknown) = NULL; -ULONG MAPINotification_registerNotifyMessageDataBase - (LPMDB iUnknown, LPMAPIADVISESINK * adviseSink); + +typedef LONG (__attribute__((__stdcall__)) MAPINotification_callback)(LPVOID, DWORD, LPNOTIFICATION); + +ULONG MAPINotification_registerNotifyMessageDataBase( + LPMDB iUnknown, + LPMAPIADVISESINK * adviseSink, + ULONG type, + MAPINotification_callback callback); ULONG MAPINotification_registerNotifyTable (LPMAPITABLE iUnknown, LPMAPIADVISESINK * adviseSink); LONG STDAPICALLTYPE MAPINotification_tableChanged @@ -163,12 +172,6 @@ void MAPINotification_jniCallDeletedMethod(LPSTR iUnknown) MAPINotification_notificationsDelegateMethodIdDeleted, value); - if(MAPINotification_notificationsDelegateCalendarObject != NULL) - tmpJniEnv->CallVoidMethod( - MAPINotification_notificationsDelegateCalendarObject, - MAPINotification_notificationsDelegateCalendarMethodIdDeleted, - value); - tmpJniEnv->DeleteLocalRef(value); MAPINotification_VM->DetachCurrentThread(); @@ -201,12 +204,6 @@ void MAPINotification_jniCallInsertedMethod(LPSTR iUnknown) MsOutlookUtils_log("MAPI notification delegate is null."); } - if(MAPINotification_notificationsDelegateCalendarObject != NULL) - tmpJniEnv->CallVoidMethod( - MAPINotification_notificationsDelegateCalendarObject, - MAPINotification_notificationsDelegateCalendarMethodIdInserted, - value); - tmpJniEnv->DeleteLocalRef(value); MAPINotification_VM->DetachCurrentThread(); @@ -232,6 +229,79 @@ void MAPINotification_jniCallUpdatedMethod(LPSTR iUnknown) MAPINotification_notificationsDelegateMethodIdUpdated, value); + tmpJniEnv->DeleteLocalRef(value); + + MAPINotification_VM->DetachCurrentThread(); + } +} + +/** + * Calls back the java side when a calendar item is deleted. + * + * @param iUnknown The string representation of the entry id of the deleted + * contact. + */ +void MAPINotification_jniCallCalendarDeletedMethod(LPSTR iUnknown) +{ + JNIEnv *tmpJniEnv = NULL; + + if(MAPINotification_VM + ->AttachCurrentThreadAsDaemon((void**) &tmpJniEnv, NULL) == 0) + { + jstring value = tmpJniEnv->NewStringUTF(iUnknown); + + if(MAPINotification_notificationsDelegateCalendarObject != NULL) + { + tmpJniEnv->CallVoidMethod( + MAPINotification_notificationsDelegateCalendarObject, + MAPINotification_notificationsDelegateCalendarMethodIdDeleted, + value); + } + + tmpJniEnv->DeleteLocalRef(value); + + MAPINotification_VM->DetachCurrentThread(); + } +} + +/** + * Calls back the java side when a calendar itm is inserted. + * + * @param iUnknown A pointer to the newly created calendar item. + */ +void MAPINotification_jniCallCalendarInsertedMethod(LPSTR iUnknown) +{ + JNIEnv *tmpJniEnv = NULL; + if(MAPINotification_VM + ->AttachCurrentThreadAsDaemon((void**) &tmpJniEnv, NULL) == 0) + { + jstring value = tmpJniEnv->NewStringUTF(iUnknown); + + if(MAPINotification_notificationsDelegateCalendarObject != NULL) + tmpJniEnv->CallVoidMethod( + MAPINotification_notificationsDelegateCalendarObject, + MAPINotification_notificationsDelegateCalendarMethodIdInserted, + value); + + tmpJniEnv->DeleteLocalRef(value); + + MAPINotification_VM->DetachCurrentThread(); + } +} + +/** + * Calls back the java side when a calendar item is updated. + * + * @param iUnknown A pointer to the updated calendar item. + */ +void MAPINotification_jniCallCalendarUpdatedMethod(LPSTR iUnknown) +{ + JNIEnv *tmpJniEnv = NULL; + if(MAPINotification_VM + ->AttachCurrentThreadAsDaemon((void**) &tmpJniEnv, NULL) == 0) + { + jstring value = tmpJniEnv->NewStringUTF(iUnknown); + if(MAPINotification_notificationsDelegateCalendarObject != NULL) tmpJniEnv->CallVoidMethod( MAPINotification_notificationsDelegateCalendarObject, @@ -253,9 +323,40 @@ void MAPINotification_jniCallUpdatedMethod(LPSTR iUnknown) * @param lpNotifications The list of notifications. */ LONG -STDAPICALLTYPE MAPINotification_onNotify +STDAPICALLTYPE MAPINotification_calendarOnNotify (LPVOID lpvContext, ULONG cNotifications, LPNOTIFICATION lpNotifications) { + return MAPINotification_onNotify(lpvContext, cNotifications, lpNotifications, + CALENDAR_FOLDER_TYPE); +} + +/** + * Functions called when an event is fired from the message data base. + * + * @param lpvContext A pointer to the message data base. + * @param cNotifications The number of event in this call. + * @param lpNotifications The list of notifications. + */ +LONG +STDAPICALLTYPE MAPINotification_contactsOnNotify + (LPVOID lpvContext, ULONG cNotifications, LPNOTIFICATION lpNotifications) +{ + return MAPINotification_onNotify(lpvContext, cNotifications, lpNotifications, + CONTACTS_FOLDER_TYPE); +} + +/** + * Functions called when an event is fired from the message data base. + * + * @param lpvContext A pointer to the message data base. + * @param cNotifications The number of event in this call. + * @param lpNotifications The list of notifications. + */ +LONG +STDAPICALLTYPE MAPINotification_onNotify + (LPVOID lpvContext, ULONG cNotifications, LPNOTIFICATION lpNotifications, + ULONG type) +{ for(unsigned int i = 0; i < cNotifications; ++i) { // A contact has been created (a new one or a copy). @@ -273,10 +374,17 @@ STDAPICALLTYPE MAPINotification_onNotify entryIdStr); if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE - && MAPINotification_callInsertedMethod != NULL) + && MAPINotification_callInsertedMethod != NULL + && type == CONTACTS_FOLDER_TYPE) { MAPINotification_callInsertedMethod(entryIdStr); } + if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE + && MAPINotification_callCalendarInsertedMethod != NULL + && type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_callCalendarInsertedMethod(entryIdStr); + } ::free(entryIdStr); entryIdStr = NULL; @@ -296,11 +404,18 @@ STDAPICALLTYPE MAPINotification_onNotify entryIdStr); if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE - && MAPINotification_callUpdatedMethod != NULL) + && MAPINotification_callUpdatedMethod != NULL + && type == CONTACTS_FOLDER_TYPE) { MAPINotification_callUpdatedMethod(entryIdStr); } + if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE + && MAPINotification_callCalendarUpdatedMethod != NULL + && type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_callCalendarUpdatedMethod(entryIdStr); + } ::free(entryIdStr); entryIdStr = NULL; @@ -316,10 +431,18 @@ STDAPICALLTYPE MAPINotification_onNotify lpNotifications[i].info.obj.cbOldID, oldEntryIdStr); if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE - && MAPINotification_callDeletedMethod != NULL) + && MAPINotification_callDeletedMethod != NULL + && type == CONTACTS_FOLDER_TYPE) { MAPINotification_callDeletedMethod(oldEntryIdStr); } + + if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE + && MAPINotification_callCalendarDeletedMethod != NULL + && type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_callCalendarDeletedMethod(oldEntryIdStr); + } ::free(oldEntryIdStr); oldEntryIdStr = NULL; } @@ -339,11 +462,19 @@ STDAPICALLTYPE MAPINotification_onNotify entryIdStr); if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE - && MAPINotification_callDeletedMethod != NULL) + && MAPINotification_callDeletedMethod != NULL + && type == CONTACTS_FOLDER_TYPE) { MAPINotification_callDeletedMethod(entryIdStr); } + if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE + && MAPINotification_callCalendarDeletedMethod != NULL + && type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_callCalendarDeletedMethod(entryIdStr); + } + ::free(entryIdStr); entryIdStr = NULL; } @@ -382,11 +513,20 @@ STDAPICALLTYPE MAPINotification_onNotify if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE && strcmp(parentEntryIdStr, wasteBasketEntryIdStr) == 0 - && MAPINotification_callDeletedMethod != NULL) + && MAPINotification_callDeletedMethod != NULL + && type == CONTACTS_FOLDER_TYPE) { MAPINotification_callDeletedMethod(entryIdStr); } + if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE + && strcmp(parentEntryIdStr, wasteBasketEntryIdStr) == 0 + && MAPINotification_callCalendarDeletedMethod != NULL + && type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_callCalendarDeletedMethod(entryIdStr); + } + ::free(entryIdStr); entryIdStr = NULL; ::free(parentEntryIdStr); @@ -407,10 +547,18 @@ STDAPICALLTYPE MAPINotification_onNotify lpNotifications[i].info.obj.cbOldID, oldEntryIdStr); if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE - && MAPINotification_callDeletedMethod != NULL) + && MAPINotification_callDeletedMethod != NULL + && type == CONTACTS_FOLDER_TYPE) { MAPINotification_callDeletedMethod(oldEntryIdStr); } + + if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE + && MAPINotification_callCalendarDeletedMethod != NULL + && type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_callCalendarDeletedMethod(oldEntryIdStr); + } ::free(oldEntryIdStr); oldEntryIdStr = NULL; } @@ -467,7 +615,6 @@ MAPINotification_registerJniNotificationsDelegate callbackClass, "deleted", "(Ljava/lang/String;)V"); - MAPINotification_callDeletedMethod = MAPINotification_jniCallDeletedMethod; MAPINotification_callInsertedMethod @@ -498,7 +645,7 @@ MAPINotification_registerCalendarJniNotificationsDelegate fprintf(stderr, "Failed to get the Java VM\n"); fflush(stderr); } - + MAPINotification_unregisterJniCalendarNotificationsDelegate(jniEnv); if(notificationsDelegate != NULL) { MAPINotification_notificationsDelegateCalendarObject @@ -523,12 +670,12 @@ MAPINotification_registerCalendarJniNotificationsDelegate "deleted", "(Ljava/lang/String;)V"); - MAPINotification_callDeletedMethod - = MAPINotification_jniCallDeletedMethod; - MAPINotification_callInsertedMethod - = MAPINotification_jniCallInsertedMethod; - MAPINotification_callUpdatedMethod - = MAPINotification_jniCallUpdatedMethod; + MAPINotification_callCalendarDeletedMethod + = MAPINotification_jniCallCalendarDeletedMethod; + MAPINotification_callCalendarInsertedMethod + = MAPINotification_jniCallCalendarInsertedMethod; + MAPINotification_callCalendarUpdatedMethod + = MAPINotification_jniCallCalendarUpdatedMethod; jniEnv->DeleteLocalRef(callbackClass); } @@ -556,6 +703,27 @@ MAPINotification_registerNativeNotificationsDelegate } /** + * Registers C callback functions when a contact is deleted, inserted or + * updated. + * + * @param deletedMethod The method to call when a contact has been deleted. + * @param insertedMethod The method to call when a contact has been inserted. + * @param updatedMethod The method to call when a contact has been updated. + */ +void +MAPINotification_registerCalendarNativeNotificationsDelegate + (void * deletedMethod, void * insertedMethod, void *updatedMethod) +{ + // If this function is called once again, then check first to unregister + // previous notification advises. + MAPINotification_unregisterNativeCalendarNotificationsDelegate(); + + MAPINotification_callCalendarDeletedMethod = (void (*)(char*)) deletedMethod; + MAPINotification_callCalendarInsertedMethod = (void (*)(char*)) insertedMethod; + MAPINotification_callCalendarUpdatedMethod = (void (*)(char*)) updatedMethod; +} + +/** * Opens all the message store and register to notifications. * * @param mapiSession The current MAPI session. @@ -609,8 +777,23 @@ void MAPINotification_registerNotifyAllMsgStores(LPMAPISESSION mapiSession) 0, rows->cRows * sizeof(LPMAPIADVISESINK)); + MAPINotification_calendarMsgStoresConnection + = (ULONG*) malloc(rows->cRows * sizeof(ULONG)); + memset( + MAPINotification_calendarMsgStoresConnection, + 0, + rows->cRows * sizeof(ULONG)); + MAPINotification_calendarAdviseSinks = (LPMAPIADVISESINK*) + malloc(rows->cRows * sizeof(LPMAPIADVISESINK)); + memset( + MAPINotification_calendarAdviseSinks, + 0, + rows->cRows * sizeof(LPMAPIADVISESINK)); + if(MAPINotification_msgStores != NULL - && MAPINotification_msgStoresConnection != NULL) + && MAPINotification_msgStoresConnection != NULL + && MAPINotification_calendarAdviseSinks != NULL + && MAPINotification_calendarMsgStoresConnection != NULL) { for(unsigned int r = 0; r < rows->cRows; ++r) { @@ -649,7 +832,16 @@ void MAPINotification_registerNotifyAllMsgStores(LPMAPISESSION mapiSession) MAPINotification_msgStoresConnection[r] = MAPINotification_registerNotifyMessageDataBase( MAPINotification_msgStores[r], - &MAPINotification_adviseSinks[r]); + &MAPINotification_adviseSinks[r], + CONTACTS_FOLDER_TYPE, + &MAPINotification_contactsOnNotify); + + MAPINotification_calendarMsgStoresConnection[r] + = MAPINotification_registerNotifyMessageDataBase( + MAPINotification_msgStores[r], + &MAPINotification_calendarAdviseSinks[r], + CALENDAR_FOLDER_TYPE, + &MAPINotification_calendarOnNotify); } } } @@ -673,18 +865,59 @@ void MAPINotification_registerNotifyAllMsgStores(LPMAPISESSION mapiSession) */ ULONG MAPINotification_registerNotifyMessageDataBase( LPMDB iUnknown, - LPMAPIADVISESINK * adviseSink) + LPMAPIADVISESINK * adviseSink, + ULONG type, + MAPINotification_callback callback) { - HrAllocAdviseSink(&MAPINotification_onNotify, iUnknown, adviseSink); - - ULONG nbConnection = 0; - iUnknown->Advise( - (ULONG) 0, - (LPENTRYID) NULL, - MAPINotification_EVENT_MASK, - *adviseSink, - (ULONG *) &nbConnection); + HrAllocAdviseSink(callback, iUnknown, adviseSink); + + LPENTRYID receiveFolderEntryID = NULL; + ULONG entrySize = 0; + LPENTRYID entryID = NULL; + ULONG receiveFolderIDByteCount = 0; + HRESULT hResult; + hResult = iUnknown->GetReceiveFolder( + NULL, + 0, + &receiveFolderIDByteCount, + &receiveFolderEntryID, + NULL); + if (HR_SUCCEEDED(hResult)) + { + hResult = MsOutlookUtils_getFolderEntryIDByType( + iUnknown, + receiveFolderIDByteCount, + receiveFolderEntryID, + &entrySize, + &entryID, + 0, + type); + MAPIFreeBuffer(receiveFolderEntryID); + } + if (HR_FAILED(hResult)) + { + hResult = MsOutlookUtils_getFolderEntryIDByType( + iUnknown, + 0, + NULL, + &entrySize, + &entryID, + 0, + type); + } + + ULONG nbConnection = 0; + if (HR_SUCCEEDED(hResult)) + { + + iUnknown->Advise( + (ULONG) entrySize, + (LPENTRYID) entryID, + MAPINotification_EVENT_MASK, + *adviseSink, + (ULONG *) &nbConnection); + } return nbConnection; } @@ -753,6 +986,18 @@ void MAPINotification_unregisterJniNotificationsDelegate(JNIEnv *jniEnv) } } +void MAPINotification_unregisterJniCalendarNotificationsDelegate(JNIEnv *jniEnv) +{ + if(MAPINotification_notificationsDelegateCalendarObject != NULL) + { + jniEnv->DeleteGlobalRef(MAPINotification_notificationsDelegateCalendarObject); + MAPINotification_notificationsDelegateCalendarObject = NULL; + MAPINotification_notificationsDelegateCalendarMethodIdInserted = NULL; + MAPINotification_notificationsDelegateCalendarMethodIdUpdated = NULL; + MAPINotification_notificationsDelegateCalendarMethodIdDeleted = NULL; + } +} + /** * Unregisters C callback functions when a contact is deleted, inserted or * updated. @@ -761,6 +1006,10 @@ void MAPINotification_unregisterNativeNotificationsDelegate() { } +void MAPINotification_unregisterNativeCalendarNotificationsDelegate() +{ +} + /** * Frees all memory used to keep in mind the list of the message store and * unregister each of them from the notifications. @@ -784,6 +1033,23 @@ void MAPINotification_unregisterNotifyAllMsgStores(void) MAPINotification_msgStoresConnection = NULL; } + if(MAPINotification_calendarMsgStoresConnection != NULL) + { + for(unsigned int i = 0; i < MAPINotification_nbMsgStores; ++i) + { + if(MAPINotification_calendarMsgStoresConnection[i] != 0) + { + MAPINotification_calendarAdviseSinks[i]->Release(); + MAPINotification_msgStores[i]->Unadvise( + MAPINotification_calendarMsgStoresConnection[i]); + } + } + free(MAPINotification_calendarAdviseSinks); + MAPINotification_calendarAdviseSinks = NULL; + free(MAPINotification_calendarMsgStoresConnection); + MAPINotification_calendarMsgStoresConnection = NULL; + } + if(MAPINotification_msgStores != NULL) { for(unsigned int i = 0; i < MAPINotification_nbMsgStores; ++i) @@ -807,3 +1073,4 @@ void MAPINotification_unregisterNotifyAllMsgStores(void) MAPINotification_msgStoresTable = NULL; } } + diff --git a/src/native/addrbook/msoutlook/MAPINotification.h b/src/native/addrbook/msoutlook/MAPINotification.h index f7b9f05..7670082 100644 --- a/src/native/addrbook/msoutlook/MAPINotification.h +++ b/src/native/addrbook/msoutlook/MAPINotification.h @@ -29,9 +29,14 @@ void MAPINotification_jniCallDeletedMethod(LPSTR iUnknown); void MAPINotification_jniCallInsertedMethod(LPSTR iUnknown); void MAPINotification_jniCallUpdatedMethod(LPSTR iUnknown); +void MAPINotification_jniCallCalendarDeletedMethod(LPSTR iUnknown); +void MAPINotification_jniCallCalendarInsertedMethod(LPSTR iUnknown); +void MAPINotification_jniCallCalendarUpdatedMethod(LPSTR iUnknown); + LONG STDAPICALLTYPE MAPINotification_onNotify - (LPVOID lpvContext, ULONG cNotifications, LPNOTIFICATION lpNotifications); + (LPVOID lpvContext, ULONG cNotifications, LPNOTIFICATION lpNotifications, + ULONG type); void MAPINotification_registerJniNotificationsDelegate @@ -43,12 +48,20 @@ MAPINotification_registerCalendarJniNotificationsDelegate void MAPINotification_registerNativeNotificationsDelegate (void * deletedMethod, void * insertedMethod, void *updatedMethod); + +void +MAPINotification_registerCalendarNativeNotificationsDelegate + (void * deletedMethod, void * insertedMethod, void *updatedMethod); + void MAPINotification_registerNotifyAllMsgStores(LPMAPISESSION mapiSession); void MAPINotification_unregisterJniNotificationsDelegate(JNIEnv *jniEnv); void MAPINotification_unregisterNativeNotificationsDelegate(); void MAPINotification_unregisterNotifyAllMsgStores(void); +void MAPINotification_unregisterJniCalendarNotificationsDelegate(JNIEnv *jniEnv); +void MAPINotification_unregisterNativeCalendarNotificationsDelegate(); + #ifdef __cplusplus } diff --git a/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx b/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx index 41fb6fd..7e6070f 100644 --- a/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx +++ b/src/native/addrbook/msoutlook/MsOutlookAddrBookContactQuery.cxx @@ -834,7 +834,7 @@ MsOutlookAddrBookContactQuery_getContactsFolderEntryID contactsFolderEntryIDByteCount, contactsFolderEntryID, flags, - 0x36D10102 /* PR_IPM_CONTACT_ENTRYID */); + CONTACTS_FOLDER_TYPE /* PR_IPM_CONTACT_ENTRYID */); } /** diff --git a/src/native/addrbook/msoutlook/MsOutlookCalendar.cxx b/src/native/addrbook/msoutlook/MsOutlookCalendar.cxx index 5667488..9e9e695 100644 --- a/src/native/addrbook/msoutlook/MsOutlookCalendar.cxx +++ b/src/native/addrbook/msoutlook/MsOutlookCalendar.cxx @@ -30,13 +30,6 @@ MsOutlookCalendar_onForeachCalendarInMsgStoresTableRow const char * query, void * callbackMethod, void * callbackClient, long callbackAddress); -static HRESULT -MsOutlookCalendar_getCalendarFolderEntryID - (LPMDB msgStore, - ULONG folderEntryIDByteCount, LPENTRYID folderEntryID, - ULONG *calendarFolderEntryIDByteCount, LPENTRYID *calendarFolderEntryID, - ULONG flags); - void MsOutlookCalendar_setCallbackObject(void *callback) { callbackObject = callback; @@ -176,7 +169,7 @@ MsOutlookCalendar_onForeachCalendarInMsgStoresTableRow return proceed; } -static HRESULT +HRESULT MsOutlookCalendar_getCalendarFolderEntryID (LPMDB msgStore, ULONG folderEntryIDByteCount, LPENTRYID folderEntryID, @@ -190,5 +183,5 @@ MsOutlookCalendar_getCalendarFolderEntryID calendarFolderEntryIDByteCount, calendarFolderEntryID, flags, - 0x36D00102); + CALENDAR_FOLDER_TYPE); } diff --git a/src/native/addrbook/msoutlook/MsOutlookCalendar.h b/src/native/addrbook/msoutlook/MsOutlookCalendar.h index e0e5322..9d2e155 100644 --- a/src/native/addrbook/msoutlook/MsOutlookCalendar.h +++ b/src/native/addrbook/msoutlook/MsOutlookCalendar.h @@ -17,5 +17,12 @@ jboolean MsOutlookCalendar_foreachCalendarItemCallback( void MsOutlookCalendar_setCallbackObject(void *callback); +HRESULT +MsOutlookCalendar_getCalendarFolderEntryID + (LPMDB msgStore, + ULONG folderEntryIDByteCount, LPENTRYID folderEntryID, + ULONG *calendarFolderEntryIDByteCount, LPENTRYID *calendarFolderEntryID, + ULONG flags); + #define MsOutlookCalendar_UUID_Address (UUID){0x00062002, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}} #endif diff --git a/src/native/addrbook/msoutlook/MsOutlookUtils.h b/src/native/addrbook/msoutlook/MsOutlookUtils.h index 3f12f3d..bbf1b2d 100644 --- a/src/native/addrbook/msoutlook/MsOutlookUtils.h +++ b/src/native/addrbook/msoutlook/MsOutlookUtils.h @@ -46,4 +46,7 @@ MsOutlookUtils_IMAPIProp_GetProps( jlongArray propIds, jlong flags, UUID UUID_Address); + +#define CALENDAR_FOLDER_TYPE 0x36D00102 +#define CONTACTS_FOLDER_TYPE 0x36D10102 #endif diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h index 9aeedce..13e3629 100644 --- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h +++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.h @@ -1,219 +1,225 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* at Tue Apr 01 12:24:18 2014 - */ -/* Compiler settings for IMsOutlookAddrBookClient.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -//#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the <rpcndr.h> version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of <rpcndr.h> -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __IMsOutlookAddrBookClient_h__ -#define __IMsOutlookAddrBookClient_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IMsOutlookAddrBookClient_FWD_DEFINED__ -#define __IMsOutlookAddrBookClient_FWD_DEFINED__ -typedef interface IMsOutlookAddrBookClient IMsOutlookAddrBookClient; -#endif /* __IMsOutlookAddrBookClient_FWD_DEFINED__ */ - - -#ifndef __IMsOutlookAddrBookClient_FWD_DEFINED__ -#define __IMsOutlookAddrBookClient_FWD_DEFINED__ -typedef interface IMsOutlookAddrBookClient IMsOutlookAddrBookClient; -#endif /* __IMsOutlookAddrBookClient_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "Unknwn.h" -#include "oaidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -#ifndef __IMsOutlookAddrBookClient_INTERFACE_DEFINED__ -#define __IMsOutlookAddrBookClient_INTERFACE_DEFINED__ - -/* interface IMsOutlookAddrBookClient */ -/* [oleautomation][dual][uuid][object] */ - - -EXTERN_C const IID IID_IMsOutlookAddrBookClient; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D579E840-B1A6-11E2-9E96-0800200C9A66") - IMsOutlookAddrBookClient : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE foreachMailUserCallback( - /* [in] */ BSTR id, - /* [in] */ long callback) = 0; - - virtual HRESULT STDMETHODCALLTYPE foreachCalendarItemCallback( - /* [in] */ BSTR id, - /* [in] */ long callback) = 0; - - virtual HRESULT STDMETHODCALLTYPE deleted( - /* [in] */ BSTR id) = 0; - - virtual HRESULT STDMETHODCALLTYPE inserted( - /* [in] */ BSTR id) = 0; - - virtual HRESULT STDMETHODCALLTYPE updated( - /* [in] */ BSTR id) = 0; - - }; - -#else /* C style interface */ - - typedef struct IMsOutlookAddrBookClientVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IMsOutlookAddrBookClient * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IMsOutlookAddrBookClient * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IMsOutlookAddrBookClient * This); - - HRESULT ( STDMETHODCALLTYPE *foreachMailUserCallback )( - IMsOutlookAddrBookClient * This, - /* [in] */ BSTR id, - /* [in] */ long callback); - - HRESULT ( STDMETHODCALLTYPE *foreachCalendarItemCallback )( - IMsOutlookAddrBookClient * This, - /* [in] */ BSTR id, - /* [in] */ long callback); - - HRESULT ( STDMETHODCALLTYPE *deleted )( - IMsOutlookAddrBookClient * This, - /* [in] */ BSTR id); - - HRESULT ( STDMETHODCALLTYPE *inserted )( - IMsOutlookAddrBookClient * This, - /* [in] */ BSTR id); - - HRESULT ( STDMETHODCALLTYPE *updated )( - IMsOutlookAddrBookClient * This, - /* [in] */ BSTR id); - - END_INTERFACE - } IMsOutlookAddrBookClientVtbl; - - interface IMsOutlookAddrBookClient - { - CONST_VTBL struct IMsOutlookAddrBookClientVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IMsOutlookAddrBookClient_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IMsOutlookAddrBookClient_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IMsOutlookAddrBookClient_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IMsOutlookAddrBookClient_foreachMailUserCallback(This,id,callback) \ - ( (This)->lpVtbl -> foreachMailUserCallback(This,id,callback) ) - -#define IMsOutlookAddrBookClient_foreachCalendarItemCallback(This,id,callback) \ - ( (This)->lpVtbl -> foreachCalendarItemCallback(This,id,callback) ) - -#define IMsOutlookAddrBookClient_deleted(This,id) \ - ( (This)->lpVtbl -> deleted(This,id) ) - -#define IMsOutlookAddrBookClient_inserted(This,id) \ - ( (This)->lpVtbl -> inserted(This,id) ) - -#define IMsOutlookAddrBookClient_updated(This,id) \ - ( (This)->lpVtbl -> updated(This,id) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IMsOutlookAddrBookClient_INTERFACE_DEFINED__ */ - - - -#ifndef __IMsOutlookAddrBookClientTypeLib_LIBRARY_DEFINED__ -#define __IMsOutlookAddrBookClientTypeLib_LIBRARY_DEFINED__ - -/* library IMsOutlookAddrBookClientTypeLib */ -/* [helpstring][version][uuid] */ - - - -EXTERN_C const IID LIBID_IMsOutlookAddrBookClientTypeLib; -#endif /* __IMsOutlookAddrBookClientTypeLib_LIBRARY_DEFINED__ */ - -/* Additional Prototypes for ALL interfaces */ - -unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); -unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); -unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); -void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - +
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0555 */
+/* at Thu May 08 16:38:42 2014
+ */
+/* Compiler settings for IMsOutlookAddrBookClient.idl:
+ Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555
+ protocol : dce , ms_ext, c_ext, robust
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
+ __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+ DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+/* @@MIDL_FILE_HEADING( ) */
+
+//#pragma warning( disable: 4049 ) /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 475
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __IMsOutlookAddrBookClient_h__
+#define __IMsOutlookAddrBookClient_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */
+
+#ifndef __IMsOutlookAddrBookClient_FWD_DEFINED__
+#define __IMsOutlookAddrBookClient_FWD_DEFINED__
+typedef interface IMsOutlookAddrBookClient IMsOutlookAddrBookClient;
+#endif /* __IMsOutlookAddrBookClient_FWD_DEFINED__ */
+
+
+#ifndef __IMsOutlookAddrBookClient_FWD_DEFINED__
+#define __IMsOutlookAddrBookClient_FWD_DEFINED__
+typedef interface IMsOutlookAddrBookClient IMsOutlookAddrBookClient;
+#endif /* __IMsOutlookAddrBookClient_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "Unknwn.h"
+#include "oaidl.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+
+#ifndef __IMsOutlookAddrBookClient_INTERFACE_DEFINED__
+#define __IMsOutlookAddrBookClient_INTERFACE_DEFINED__
+
+/* interface IMsOutlookAddrBookClient */
+/* [oleautomation][dual][uuid][object] */
+
+
+EXTERN_C const IID IID_IMsOutlookAddrBookClient;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("D579E840-B1A6-11E2-9E96-0800200C9A66")
+ IMsOutlookAddrBookClient : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE foreachMailUserCallback(
+ /* [in] */ BSTR id,
+ /* [in] */ long callback) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE foreachCalendarItemCallback(
+ /* [in] */ BSTR id,
+ /* [in] */ long callback) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE deleted(
+ /* [in] */ BSTR id,
+ /* [in] */ ULONG type) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE inserted(
+ /* [in] */ BSTR id,
+ /* [in] */ ULONG type) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE updated(
+ /* [in] */ BSTR id,
+ /* [in] */ ULONG type) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMsOutlookAddrBookClientVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMsOutlookAddrBookClient * This,
+ /* [in] */ REFIID riid,
+ /* [annotation][iid_is][out] */
+ __RPC__deref_out void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMsOutlookAddrBookClient * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMsOutlookAddrBookClient * This);
+
+ HRESULT ( STDMETHODCALLTYPE *foreachMailUserCallback )(
+ IMsOutlookAddrBookClient * This,
+ /* [in] */ BSTR id,
+ /* [in] */ long callback);
+
+ HRESULT ( STDMETHODCALLTYPE *foreachCalendarItemCallback )(
+ IMsOutlookAddrBookClient * This,
+ /* [in] */ BSTR id,
+ /* [in] */ long callback);
+
+ HRESULT ( STDMETHODCALLTYPE *deleted )(
+ IMsOutlookAddrBookClient * This,
+ /* [in] */ BSTR id,
+ /* [in] */ ULONG type);
+
+ HRESULT ( STDMETHODCALLTYPE *inserted )(
+ IMsOutlookAddrBookClient * This,
+ /* [in] */ BSTR id,
+ /* [in] */ ULONG type);
+
+ HRESULT ( STDMETHODCALLTYPE *updated )(
+ IMsOutlookAddrBookClient * This,
+ /* [in] */ BSTR id,
+ /* [in] */ ULONG type);
+
+ END_INTERFACE
+ } IMsOutlookAddrBookClientVtbl;
+
+ interface IMsOutlookAddrBookClient
+ {
+ CONST_VTBL struct IMsOutlookAddrBookClientVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMsOutlookAddrBookClient_QueryInterface(This,riid,ppvObject) \
+ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
+
+#define IMsOutlookAddrBookClient_AddRef(This) \
+ ( (This)->lpVtbl -> AddRef(This) )
+
+#define IMsOutlookAddrBookClient_Release(This) \
+ ( (This)->lpVtbl -> Release(This) )
+
+
+#define IMsOutlookAddrBookClient_foreachMailUserCallback(This,id,callback) \
+ ( (This)->lpVtbl -> foreachMailUserCallback(This,id,callback) )
+
+#define IMsOutlookAddrBookClient_foreachCalendarItemCallback(This,id,callback) \
+ ( (This)->lpVtbl -> foreachCalendarItemCallback(This,id,callback) )
+
+#define IMsOutlookAddrBookClient_deleted(This,id,type) \
+ ( (This)->lpVtbl -> deleted(This,id,type) )
+
+#define IMsOutlookAddrBookClient_inserted(This,id,type) \
+ ( (This)->lpVtbl -> inserted(This,id,type) )
+
+#define IMsOutlookAddrBookClient_updated(This,id,type) \
+ ( (This)->lpVtbl -> updated(This,id,type) )
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+
+#endif /* __IMsOutlookAddrBookClient_INTERFACE_DEFINED__ */
+
+
+
+#ifndef __IMsOutlookAddrBookClientTypeLib_LIBRARY_DEFINED__
+#define __IMsOutlookAddrBookClientTypeLib_LIBRARY_DEFINED__
+
+/* library IMsOutlookAddrBookClientTypeLib */
+/* [helpstring][version][uuid] */
+
+
+
+EXTERN_C const IID LIBID_IMsOutlookAddrBookClientTypeLib;
+#endif /* __IMsOutlookAddrBookClientTypeLib_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
+unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
+unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
+void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl index 30f457a..1dcb63e 100644 --- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl +++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.idl @@ -17,11 +17,14 @@ interface IMsOutlookAddrBookClient : IUnknown [in] long callback); HRESULT deleted( - [in] BSTR id); + [in] BSTR id, + [in] ULONG type); HRESULT inserted( - [in] BSTR id); + [in] BSTR id, + [in] ULONG type); HRESULT updated( - [in] BSTR id); + [in] BSTR id, + [in] ULONG type); }; diff --git a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb Binary files differindex 6873acd..d28ca10 100644 --- a/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb +++ b/src/native/addrbook/msoutlook/com/IMsOutlookAddrBookClient.tlb diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx index c0564e2..4357eb9 100644 --- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx +++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.cxx @@ -13,6 +13,7 @@ #include "../MsOutlookCalendar.h" #include "../net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h" #include "../StringUtils.h" +#include "../MsOutlookUtils.h" /** * Instanciates a new MsOutlookAddrBookClient. @@ -135,10 +136,17 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::foreachCalendarItemCallback( * * @return S_OK. */ -HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::deleted(BSTR id) +HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::deleted(BSTR id, ULONG type) { char * charId = StringUtils::WideCharToMultiByte(id); - MAPINotification_jniCallDeletedMethod(charId); + if(type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_jniCallCalendarDeletedMethod(charId); + } + else + { + MAPINotification_jniCallDeletedMethod(charId); + } free(charId); return S_OK; @@ -152,10 +160,17 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::deleted(BSTR id) * * @return S_OK. */ -HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::inserted(BSTR id) +HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::inserted(BSTR id, ULONG type) { char * charId = StringUtils::WideCharToMultiByte(id); - MAPINotification_jniCallInsertedMethod(charId); + if(type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_jniCallCalendarInsertedMethod(charId); + } + else + { + MAPINotification_jniCallInsertedMethod(charId); + } free(charId); return S_OK; @@ -169,10 +184,18 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::inserted(BSTR id) * * @return S_OK. */ -HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::updated(BSTR id) +HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::updated(BSTR id, ULONG type) { char * charId = StringUtils::WideCharToMultiByte(id); - MAPINotification_jniCallUpdatedMethod(charId); + if(type == CALENDAR_FOLDER_TYPE) + { + MAPINotification_jniCallCalendarUpdatedMethod(charId); + } + else + { + MAPINotification_jniCallUpdatedMethod(charId); + } + free(charId); return S_OK; diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h index 06e1847..7ce1e70 100644 --- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h +++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookClient.h @@ -40,9 +40,9 @@ class MsOutlookAddrBookClient: HRESULT STDMETHODCALLTYPE foreachCalendarItemCallback( BSTR id, long callback); - HRESULT STDMETHODCALLTYPE deleted(BSTR id); - HRESULT STDMETHODCALLTYPE inserted(BSTR id); - HRESULT STDMETHODCALLTYPE updated(BSTR id); + HRESULT STDMETHODCALLTYPE deleted(BSTR id, ULONG type); + HRESULT STDMETHODCALLTYPE inserted(BSTR id, ULONG type); + HRESULT STDMETHODCALLTYPE updated(BSTR id, ULONG type); protected: virtual ~MsOutlookAddrBookClient(); diff --git a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx index 07f7d0b..aba0de1 100644 --- a/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx +++ b/src/native/addrbook/msoutlook/com/MsOutlookAddrBookServer.cxx @@ -269,9 +269,10 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::IMAPIProp_GetProps( unsigned long* localPropsLength = NULL; // b = byteArray, l = long, s = 8 bits string, u = 16 bits string. char * localPropsType = NULL; - + MsOutlookUtils_logInfo("AAAAA"); if((localProps = (void**) malloc(nbPropIds * sizeof(void*))) != NULL) { + MsOutlookUtils_logInfo("AAAAA1111"); memset(localProps, 0, nbPropIds * sizeof(void*)); if((localPropsLength = (unsigned long*) malloc( nbPropIds * sizeof(unsigned long))) != NULL) @@ -279,6 +280,7 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::IMAPIProp_GetProps( if((localPropsType = (char*) malloc(nbPropIds * sizeof(char))) != NULL) { + MsOutlookUtils_logInfo("AAAA2222A"); SafeArrayLock(propIds); long * longPropIds = (long*) propIds->pvData; SafeArrayUnlock(propIds); @@ -297,8 +299,10 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::IMAPIProp_GetProps( free(id); + if(HR_SUCCEEDED(hr)) { + MsOutlookUtils_logInfo("AAAAA3333"); long totalLength = 0; for(int j = 0; j < nbPropIds; ++j) { diff --git a/src/native/addrbook/msoutlook/com/server/Server.cxx b/src/native/addrbook/msoutlook/com/server/Server.cxx index ec9fc05..0bbb093 100644 --- a/src/native/addrbook/msoutlook/com/server/Server.cxx +++ b/src/native/addrbook/msoutlook/com/server/Server.cxx @@ -12,6 +12,7 @@ #include "../MsOutlookAddrBookServerClassFactory.h" #include "../TypeLib.h" #include "../../MsOutlookUtils.h" +#include "../../MAPINotification.h" #include <stdio.h> #include <string.h> @@ -21,9 +22,15 @@ #define MAPI_NO_COINIT 8 void waitParentProcessStop(); -static void Server_deleted(LPSTR id); -static void Server_inserted(LPSTR id); -static void Server_updated(LPSTR id); +static void Server_contactDeleted(LPSTR id); +static void Server_contactInserted(LPSTR id); +static void Server_contactUpdated(LPSTR id); +static void Server_calendarDeleted(LPSTR id); +static void Server_calendarInserted(LPSTR id); +static void Server_calendarUpdated(LPSTR id); +static void Server_deleted(LPSTR id, ULONG type); +static void Server_inserted(LPSTR id, ULONG type); +static void Server_updated(LPSTR id, ULONG type); /** * Starts the COM server. @@ -47,7 +54,6 @@ int main(int argc, char** argv) MsOutlookUtils_logInfo(argv[1]); MsOutlookUtils_logInfo(argv[2]); MsOutlookUtils_logInfo("Starting the Outlook Server."); - MsOutlookUtils_log("Test"); if((hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED)) != S_OK && hr != S_FALSE) { @@ -58,15 +64,19 @@ int main(int argc, char** argv) if(MsOutlookAddrBookContactSourceService_NativeMAPIInitialize( MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT, - (void*) Server_deleted, - (void*) Server_inserted, - (void*) Server_updated) + (void*) Server_contactDeleted, + (void*) Server_contactInserted, + (void*) Server_contactUpdated) != S_OK) { MsOutlookUtils_logInfo("Error in native MAPI initialization of the Outlook Server.[2]"); CoUninitialize(); return hr; } + MAPINotification_registerCalendarNativeNotificationsDelegate( + (void*) Server_calendarDeleted, + (void*) Server_calendarInserted, + (void*) Server_calendarUpdated); WCHAR * path = (WCHAR*) L"IMsOutlookAddrBookServer.tlb"; LPTYPELIB typeLib = TypeLib_loadRegTypeLib(path); @@ -169,7 +179,7 @@ void waitParentProcessStop() * * @param id The contact identifer. */ -static void Server_deleted(LPSTR id) +static void Server_deleted(LPSTR id, ULONG type) { HRESULT hr = E_FAIL; @@ -183,7 +193,7 @@ static void Server_deleted(LPSTR id) { LPWSTR idW = StringUtils::MultiByteToWideChar(id); BSTR res = SysAllocString(idW); - msOutlookAddrBookClient->deleted(res); + msOutlookAddrBookClient->deleted(res, type); SysFreeString(res); free(idW); msOutlookAddrBookClient->Release(); @@ -196,7 +206,7 @@ static void Server_deleted(LPSTR id) * * @param id The contact identifer. */ -static void Server_inserted(LPSTR id) +static void Server_inserted(LPSTR id, ULONG type) { HRESULT hr = E_FAIL; @@ -210,7 +220,7 @@ static void Server_inserted(LPSTR id) { LPWSTR idW = StringUtils::MultiByteToWideChar(id); BSTR res = SysAllocString(idW); - msOutlookAddrBookClient->inserted(res); + msOutlookAddrBookClient->inserted(res, type); SysFreeString(res); free(idW); msOutlookAddrBookClient->Release(); @@ -223,7 +233,7 @@ static void Server_inserted(LPSTR id) * * @param id The contact identifer. */ -static void Server_updated(LPSTR id) +static void Server_updated(LPSTR id, ULONG type) { HRESULT hr = E_FAIL; @@ -237,9 +247,39 @@ static void Server_updated(LPSTR id) { LPWSTR idW = StringUtils::MultiByteToWideChar(id); BSTR res = SysAllocString(idW); - msOutlookAddrBookClient->updated(res); + msOutlookAddrBookClient->updated(res, type); SysFreeString(res); free(idW); msOutlookAddrBookClient->Release(); } } + +static void Server_contactDeleted(LPSTR id) +{ + Server_deleted(id, CONTACTS_FOLDER_TYPE); +} + +static void Server_contactInserted(LPSTR id) +{ + Server_inserted(id, CONTACTS_FOLDER_TYPE); +} + +static void Server_contactUpdated(LPSTR id) +{ + Server_updated(id, CONTACTS_FOLDER_TYPE); +} + +static void Server_calendarDeleted(LPSTR id) +{ + Server_deleted(id, CALENDAR_FOLDER_TYPE); +} + +static void Server_calendarInserted(LPSTR id) +{ + Server_inserted(id, CALENDAR_FOLDER_TYPE); +} + +static void Server_calendarUpdated(LPSTR id) +{ + Server_updated(id, CALENDAR_FOLDER_TYPE); +} diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx index c5b2bb0..e541eb9 100644 --- a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx @@ -20,12 +20,12 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac jobject notificationsDelegate, jstring logPath, jint logLevel) { HRESULT hr; - + const char* logFileString = jniEnv->GetStringUTFChars(logPath, NULL); + MsOutlookUtils_createLogger("msoutlookaddrbook.log", logFileString, logLevel); MAPINotification_registerJniNotificationsDelegate( jniEnv, notificationsDelegate); - const char* logFileString = jniEnv->GetStringUTFChars(logPath, NULL); - MsOutlookUtils_createLogger("msoutlookaddrbook.log", logFileString, logLevel); + jniEnv->ReleaseStringUTFChars(logPath, logFileString); hr = MsOutlookAddrBookContactSourceService_MAPIInitializeCOMServer(); |