Adds management of Outlook contact with multiple identifier. Corrects null pointer segmentation fault when comparing entry identifiers. Uses MAPI service provider to retrieve a tag corresponding to a property identifier.

cusax-fix
Vincent Lucas 13 years ago
parent 6939b99d6a
commit cd56bd88b2

@ -10,6 +10,7 @@
#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
#include "MsOutlookAddrBookContactSourceService.h"
#include "MsOutlookAddrBookContactQuery.h"
#include <mapidefs.h>
#include <stdio.h>
@ -29,7 +30,8 @@ static ULONG MAPINotification_EVENT_MASK
= fnevObjectCreated
| fnevObjectDeleted
| fnevObjectModified
| fnevObjectMoved;
| fnevObjectMoved
| fnevObjectCopied;
static LPMDB * MAPINotification_msgStores = NULL;
static ULONG * MAPINotification_msgStoresConnection = NULL;
@ -121,9 +123,12 @@ void MAPINotification_jniCallDeletedMethod(LPSTR iUnknown)
if(MAPINotification_VM
->AttachCurrentThreadAsDaemon((void**) &tmpJniEnv, NULL) == 0)
{
fprintf(stdout, "MAPINotification_jniCallDeletedMethod: id: %s\n",
iUnknown);
fflush(stdout);
jstring value = tmpJniEnv->NewStringUTF(iUnknown);
tmpJniEnv->CallBooleanMethod(
tmpJniEnv->CallVoidMethod(
MAPINotification_notificationsDelegateObject,
MAPINotification_notificationsDelegateMethodIdDeleted,
value);
@ -146,7 +151,7 @@ void MAPINotification_jniCallInsertedMethod(LPSTR iUnknown)
{
jstring value = tmpJniEnv->NewStringUTF(iUnknown);
tmpJniEnv->CallBooleanMethod(
tmpJniEnv->CallVoidMethod(
MAPINotification_notificationsDelegateObject,
MAPINotification_notificationsDelegateMethodIdInserted,
value);
@ -169,7 +174,7 @@ void MAPINotification_jniCallUpdatedMethod(LPSTR iUnknown)
{
jstring value = tmpJniEnv->NewStringUTF(iUnknown);
tmpJniEnv->CallBooleanMethod(
tmpJniEnv->CallVoidMethod(
MAPINotification_notificationsDelegateObject,
MAPINotification_notificationsDelegateMethodIdUpdated,
value);
@ -200,8 +205,9 @@ STDAPICALLTYPE MAPINotification_onNotify
lpvContext);
}
// A contact has been created
if(lpNotifications[i].ulEventType == fnevObjectCreated)
// A contact has been created (a new one or a copy).
if(lpNotifications[i].ulEventType == fnevObjectCreated
|| lpNotifications[i].ulEventType == fnevObjectCopied)
{
if(lpvContext != NULL)
{
@ -244,6 +250,30 @@ STDAPICALLTYPE MAPINotification_onNotify
::free(entryIdStr);
entryIdStr = NULL;
// If the entry identifier has changed, then deletes the old
// one.
if(lpNotifications[i].info.obj.lpOldID != NULL
&& lpNotifications[i].info.obj.cbOldID > 0)
{
LPSTR oldEntryIdStr = (LPSTR)
::malloc((lpNotifications[i].info.obj.cbOldID + 1) * 2);
HexFromBin(
(LPBYTE) lpNotifications[i].info.obj.lpOldID,
lpNotifications[i].info.obj.cbOldID,
oldEntryIdStr);
fprintf(stdout,
"MAPINotification_onNotify: evModified oldID: %s\n",
oldEntryIdStr);
fflush(stdout);
if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE
&& MAPINotification_callDeletedMethod != NULL)
{
MAPINotification_callDeletedMethod(oldEntryIdStr);
}
::free(oldEntryIdStr);
oldEntryIdStr = NULL;
}
}
}
// A contact has been deleted.
@ -259,6 +289,10 @@ STDAPICALLTYPE MAPINotification_onNotify
lpNotifications[i].info.obj.cbEntryID,
entryIdStr);
fprintf(stdout, "MAPINotification_onNotify: evDeleted: %s\n",
entryIdStr);
fflush(stdout);
if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE
&& MAPINotification_callDeletedMethod != NULL)
{
@ -306,6 +340,54 @@ STDAPICALLTYPE MAPINotification_onNotify
lpNotifications[i].info.obj.lpParentID,
lpvContext);
fprintf(stdout,
"MAPINotification_onNotify: evMoved: bin %s / %s / %s\n",
entryIdStr,
parentEntryIdStr,
wasteBasketEntryIdStr);
fflush(stdout);
LPUNKNOWN entryDirBin =
MAPINotification_openEntry(
lpNotifications[i].info.obj.cbEntryID,
(LPENTRYID) lpNotifications[i].info.obj.lpEntryID,
lpvContext);
char* entryDir
= MsOutlookAddrBookContactQuery_getStringUnicodeProp(
entryDirBin,
0x3001); // PR_DISPLAY_NAME
LPUNKNOWN parentEntryDirBin =
MAPINotification_openEntry(
lpNotifications[i].info.obj.cbParentID,
(LPENTRYID) lpNotifications[i].info.obj.lpParentID,
lpvContext);
char* parentEntryDir
= MsOutlookAddrBookContactQuery_getStringUnicodeProp(
parentEntryDirBin,
0x3001); // PR_DISPLAY_NAME
LPUNKNOWN basketEntryDirBin =
MAPINotification_openEntry(
wasteBasketProps[0].Value.bin.cb,
(LPENTRYID) wasteBasketProps[0].Value.bin.lpb,
lpvContext);
char* basketEntryDir
= MsOutlookAddrBookContactQuery_getStringUnicodeProp(
basketEntryDirBin,
0x3001); // PR_DISPLAY_NAME
fprintf(stdout,
"MAPINotification_onNotify: evMoved: %s / %s / %s\n",
entryDir,
parentEntryDir,
basketEntryDir);
fflush(stdout);
free(entryDir);
free(parentEntryDir);
free(basketEntryDir);
if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE
&& strcmp(parentEntryIdStr, wasteBasketEntryIdStr) == 0
@ -320,6 +402,30 @@ STDAPICALLTYPE MAPINotification_onNotify
parentEntryIdStr = NULL;
::free(wasteBasketEntryIdStr);
wasteBasketEntryIdStr = NULL;
// If the entry identifier has changed, then deletes the old
// one.
if(lpNotifications[i].info.obj.lpOldID != NULL
&& lpNotifications[i].info.obj.cbOldID > 0)
{
LPSTR oldEntryIdStr = (LPSTR)
::malloc((lpNotifications[i].info.obj.cbOldID + 1) * 2);
HexFromBin(
(LPBYTE) lpNotifications[i].info.obj.lpOldID,
lpNotifications[i].info.obj.cbOldID,
oldEntryIdStr);
fprintf(stdout,
"MAPINotification_onNotify: evMoved oldID: %s\n",
oldEntryIdStr);
fflush(stdout);
if(lpNotifications[i].info.obj.ulObjType == MAPI_MESSAGE
&& MAPINotification_callDeletedMethod != NULL)
{
MAPINotification_callDeletedMethod(oldEntryIdStr);
}
::free(oldEntryIdStr);
oldEntryIdStr = NULL;
}
}
}

@ -90,6 +90,8 @@ static HRESULT MsOutlookAddrBookContactQuery_getContactsFolderEntryID
LPSTR MsOutlookAddrBookContactQuery_getContactId(LPMAPIPROP contact);
LPMAPIFOLDER MsOutlookAddrBookContactQuery_getDefaultContactFolderId(void);
LPMDB MsOutlookAddrBookContactQuery_getDefaultMsgStores(void);
ULONG MsOutlookAddrBookContactQuery_getPropTag
(LPMAPIPROP mapiProp, long propId, long propType);
static ULONG MsOutlookAddrBookContactQuery_getPropTagFromLid
(LPMAPIPROP mapiProp, LONG lid);
static jboolean MsOutlookAddrBookContactQuery_mailUserMatches
@ -996,6 +998,39 @@ LPMDB MsOutlookAddrBookContactQuery_getDefaultMsgStores(void)
return msgStore;
}
/**
* Returns the property tag associated for the given identifier and type.
*
* @param mapiProp The MAPI object from which we need to get the property tag
* for a given identifier.
* @param propId The identifier to resolve into a tag.
* @param propType The type of the property (PT_UNSPECIFIED, PT_UNICODE, etc.).
*
* @return The property tag associated for the given identifier and type.
*/
ULONG MsOutlookAddrBookContactQuery_getPropTag
(LPMAPIPROP mapiProp, long propId, long propType)
{
ULONG propTag;
if (propId < 0x8000)
{
if (propId == PROP_ID(PR_ATTACHMENT_CONTACTPHOTO))
propTag = PR_HASATTACH;
else
propTag = PROP_TAG(propType, propId);
}
else
{
propTag = MsOutlookAddrBookContactQuery_getPropTagFromLid(
(LPMAPIPROP) mapiProp,
(LONG)propId);
propTag = CHANGE_PROP_TYPE(propTag, propType);
}
return propTag;
}
static ULONG
MsOutlookAddrBookContactQuery_getPropTagFromLid(LPMAPIPROP mapiProp, LONG lid)
{
@ -1129,9 +1164,10 @@ int MsOutlookAddrBookContactQuery_IMAPIProp_1DeleteProp
propTagArray->cValues = nbProps;
for(unsigned int i = 0; i < nbProps; ++i)
{
propTag = MsOutlookAddrBookContactQuery_getPropTagFromLid(
propTag = MsOutlookAddrBookContactQuery_getPropTag(
(LPMAPIPROP) mapiProp,
propIds[i]);
propIds[i],
PT_UNICODE);
*(propTagArray->aulPropTag + i) = propTag;
}
@ -1162,14 +1198,10 @@ int MsOutlookAddrBookContactQuery_IMAPIProp_1DeleteProp
SPropTagArray propToDelete;
propToDelete.cValues = 1;
if(propId == 0x8062) // PidLidInstantMessagingAddress
{
propToDelete.aulPropTag[0] = 0x8046001F;
}
else
{
propToDelete.aulPropTag[0] = PROP_TAG(PT_UNICODE, propId);
}
propToDelete.aulPropTag[0] = MsOutlookAddrBookContactQuery_getPropTag(
(LPMAPIPROP) mapiProp,
propId,
PT_UNICODE);
HRESULT hResult
= ((LPMAPIPROP) mapiProp)->DeleteProps(
@ -1227,22 +1259,10 @@ HRESULT MsOutlookAddrBookContactQuery_IMAPIProp_1GetProps(
long propId = propIds[i];
ULONG propTag;
if (propId < 0x8000)
{
if (propId == PROP_ID(PR_ATTACHMENT_CONTACTPHOTO))
propTag = PR_HASATTACH;
else
propTag = PROP_TAG(PT_UNSPECIFIED, propId);
}
else
{
propTag
= MsOutlookAddrBookContactQuery_getPropTagFromLid(
(LPMAPIPROP) mapiProp,
(LONG)propId);
}
ULONG propTag = MsOutlookAddrBookContactQuery_getPropTag(
(LPMAPIPROP) mapiProp,
propId,
PT_UNSPECIFIED);
*(propTagArray->aulPropTag + i) = propTag;
}
@ -1437,9 +1457,10 @@ int MsOutlookAddrBookContactQuery_IMAPIProp_1SetPropString
propTagArray->cValues = nbProps;
for(unsigned int i = 0; i < nbProps; ++i)
{
propTag = MsOutlookAddrBookContactQuery_getPropTagFromLid(
propTag = MsOutlookAddrBookContactQuery_getPropTag(
(LPMAPIPROP) mapiProp,
propIds[i]);
propIds[i],
PT_UNSPECIFIED);
*(propTagArray->aulPropTag + i) = propTag;
}
hResult = ((LPMAPIPROP) mapiProp)->GetProps(
@ -1497,34 +1518,10 @@ int MsOutlookAddrBookContactQuery_IMAPIProp_1SetPropString
}
SPropValue updateValue;
if(propId == 0x8062) // PidLidInstantMessagingAddress
{
updateValue.ulPropTag = 0x8046001F;
}
else if(propId == 0x8045) // business address - street
{
updateValue.ulPropTag = 0x805F001F;
}
else if(propId == 0x8046) // business address - city
{
updateValue.ulPropTag = 0x8060001F;
}
else if(propId == 0x8047) // business address - state
{
updateValue.ulPropTag = 0x8061001F;
}
else if(propId == 0x8048) // business address - zip
{
updateValue.ulPropTag = 0x8062001F;
}
else if(propId == 0x8049) // business address - country
{
updateValue.ulPropTag = 0x8063001F;
}
else
{
updateValue.ulPropTag = PROP_TAG(PT_UNICODE, propId);
}
updateValue.ulPropTag = MsOutlookAddrBookContactQuery_getPropTag(
(LPMAPIPROP) mapiProp,
propId,
PT_UNICODE);
updateValue.Value.lpszW = wCharValue;
hResult = ((LPMAPIPROP) mapiProp)->SetProps(
@ -1792,3 +1789,140 @@ MsOutlookAddrBookContactQuery_readAttachment
}
return attachment;
}
/**
* Gets a string property for a given entry.
*
* @param entry The entry to red the property from.
* @param propId The property identifier.
*
* @return A string representation of the property value retrieved. Must be
* freed by the caller.
*/
char* MsOutlookAddrBookContactQuery_getStringUnicodeProp
(LPUNKNOWN entry, ULONG propId)
{
SPropTagArray tagArray;
tagArray.cValues = 1;
tagArray.aulPropTag[0] = PROP_TAG(PT_UNICODE, propId);
ULONG propCount;
LPSPropValue propArray;
HRESULT hResult = ((LPMAPIPROP)entry)->GetProps(
&tagArray,
0x80000000, // MAPI_UNICODE.
&propCount,
&propArray);
if (HR_SUCCEEDED(hResult))
{
unsigned int length = wcslen(propArray->Value.lpszW);
char * value;
if((value = (char*) malloc((length + 1) * sizeof(char)))
== NULL)
{
fprintf(stderr,
"getStringUnicodeProp (addrbook/MsOutlookAddrBookContactQuery.c): \
\n\tmalloc\n");
fflush(stderr);
}
if(wcstombs(value, propArray->Value.lpszW, length + 1) != length)
{
fprintf(stderr,
"getStringUnicodeProp (addrbook/MsOutlookAddrBookContactQuery.c): \
\n\tmbstowcs\n");
fflush(stderr);
::free(value);
value = NULL;
return NULL;
}
return value;
}
return NULL;
}
/**
* Compares two identifiers to determine if they are part of the same
* Outlook contact.
*
* @param id1 The first identifier.
* @param id2 The second identifier.
*
* @result True if id1 and id2 are two identifiers of the same contact. False
* otherwise.
*/
int MsOutlookAddrBookContactQuery_compareEntryIds(
LPSTR id1,
LPSTR id2)
{
if(strcmp(id1, id2) == 0)
{
fprintf(stderr,
"CHENZO compareEntryIds: \
\n\tid1: %s\
\n\tid2: %s\n",
id1,
id2);
fflush(stderr);
}
//id2 = "ROH";
int result = 0;
LPMAPISESSION session = MAPISession_getMapiSession();
LPMAPIPROP mapiId1;
if((mapiId1 = (LPMAPIPROP)
MsOutlookAddrBookContactQuery_openEntryIdStr(id1))
== NULL)
{
return result;
}
SBinary contactId1;
contactId1.cb = 0;
MsOutlookAddrBookContactQuery_getBinaryProp(mapiId1, 0x0FFF, &contactId1);
LPMAPIPROP mapiId2;
if((mapiId2 = (LPMAPIPROP)
MsOutlookAddrBookContactQuery_openEntryIdStr(id2))
== NULL)
{
return result;
}
SBinary contactId2;
contactId2.cb = 0;
MsOutlookAddrBookContactQuery_getBinaryProp(mapiId2, 0x0FFF, &contactId2);
if(session != NULL)
{
ULONG res;
if(session->CompareEntryIDs(
contactId1.cb,
(LPENTRYID) contactId1.lpb,
contactId2.cb,
(LPENTRYID) contactId2.lpb,
0,
&res) != S_OK)
{
fprintf(stderr,
"compareEntryIds (addrbook/MsOutlookAddrBookContactQuery.c): \
\n\tMAPISession::CompareEntryIDs\n");
fflush(stderr);
return result;
}
result = res;
}
if(strcmp(id1, id2) == 0)
{
fprintf(stderr,
"CHENZO compareEntryIds: \
\n\tid1: %s\
\n\tid2: %s\
\n\tresult: %d\n",
id1,
id2,
result);
fflush(stderr);
}
return result;
}

@ -7,6 +7,8 @@
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKADDRBOOKCONTACTQUERY_H_
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKADDRBOOKCONTACTQUERY_H_
#include <mapidefs.h>
int MsOutlookAddrBookContactQuery_IMAPIProp_1DeleteProp
(long propId, const char * nativeEntryId);
@ -29,4 +31,10 @@ int MsOutlookAddrBookContactQuery_deleteContact(const char * nativeEntryId);
void MsOutlookAddrBookContactQuery_foreachMailUser
(const char * query, void * callback, void * callbackObject);
char* MsOutlookAddrBookContactQuery_getStringUnicodeProp
(LPUNKNOWN entry, ULONG propId);
int MsOutlookAddrBookContactQuery_compareEntryIds
(LPSTR id1, LPSTR id2);
#endif

@ -1,62 +1,62 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKADDRBOOKCONTACTSOURCESERVICE_H_
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKADDRBOOKCONTACTSOURCESERVICE_H_
#include <jni.h>
#include <mapix.h>
BOOL MsOutlookAddrBook_fBinFromHex(LPSTR lpsz, LPBYTE lpb);
#define FBinFromHex MsOutlookAddrBook_fBinFromHex
void MsOutlookAddrBook_freeProws(LPSRowSet lpRows);
#define FreeProws MsOutlookAddrBook_freeProws
void MsOutlookAddrBook_hexFromBin(LPBYTE pb, int cb, LPSTR sz);
#define HexFromBin MsOutlookAddrBook_hexFromBin
void MsOutlookAddrBook_hrAllocAdviseSink
(LPNOTIFCALLBACK lpfnCallback, LPVOID lpvContext,
LPMAPIADVISESINK* lppAdviseSink);
#define HrAllocAdviseSink MsOutlookAddrBook_hrAllocAdviseSink
HRESULT MsOutlookAddrBook_hrQueryAllRows
(LPMAPITABLE lpTable, LPSPropTagArray lpPropTags,
LPSRestriction lpRestriction, LPSSortOrderSet lpSortOrderSet,
LONG crowsMax, LPSRowSet* lppRows);
#define HrQueryAllRows MsOutlookAddrBook_hrQueryAllRows
SCODE MsOutlookAddrBook_mapiAllocateBuffer(ULONG size, LPVOID FAR *buffer);
#define MAPIAllocateBuffer MsOutlookAddrBook_mapiAllocateBuffer
ULONG MsOutlookAddrBook_mapiFreeBuffer(LPVOID buffer);
#define MAPIFreeBuffer MsOutlookAddrBook_mapiFreeBuffer
HRESULT MsOutlookAddrBook_mapiLogonEx
(ULONG_PTR uiParam,
LPTSTR profileName, LPTSTR password,
FLAGS flags,
LPMAPISESSION FAR *mapiSession);
#define MAPILogonEx MsOutlookAddrBook_mapiLogonEx
HRESULT MsOutlookAddrBookContactSourceService_MAPIInitialize
(jlong version, jlong flags);
HRESULT MsOutlookAddrBookContactSourceService_MAPIInitializeCOMServer(void);
void MsOutlookAddrBookContactSourceService_MAPIUninitialize(void);
void MsOutlookAddrBookContactSourceService_MAPIUninitializeCOMServer(void);
HRESULT MsOutlookAddrBookContactSourceService_NativeMAPIInitialize
(jlong version, jlong flags,
void * deletedMethod, void * insertedMethod, void * updatedMethod);
void MsOutlookAddrBookContactSourceService_NativeMAPIUninitialize(void);
#endif
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKADDRBOOKCONTACTSOURCESERVICE_H_
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKADDRBOOKCONTACTSOURCESERVICE_H_
#include <jni.h>
#include <mapix.h>
BOOL MsOutlookAddrBook_fBinFromHex(LPSTR lpsz, LPBYTE lpb);
#define FBinFromHex MsOutlookAddrBook_fBinFromHex
void MsOutlookAddrBook_freeProws(LPSRowSet lpRows);
#define FreeProws MsOutlookAddrBook_freeProws
void MsOutlookAddrBook_hexFromBin(LPBYTE pb, int cb, LPSTR sz);
#define HexFromBin MsOutlookAddrBook_hexFromBin
void MsOutlookAddrBook_hrAllocAdviseSink
(LPNOTIFCALLBACK lpfnCallback, LPVOID lpvContext,
LPMAPIADVISESINK* lppAdviseSink);
#define HrAllocAdviseSink MsOutlookAddrBook_hrAllocAdviseSink
HRESULT MsOutlookAddrBook_hrQueryAllRows
(LPMAPITABLE lpTable, LPSPropTagArray lpPropTags,
LPSRestriction lpRestriction, LPSSortOrderSet lpSortOrderSet,
LONG crowsMax, LPSRowSet* lppRows);
#define HrQueryAllRows MsOutlookAddrBook_hrQueryAllRows
SCODE MsOutlookAddrBook_mapiAllocateBuffer(ULONG size, LPVOID FAR *buffer);
#define MAPIAllocateBuffer MsOutlookAddrBook_mapiAllocateBuffer
ULONG MsOutlookAddrBook_mapiFreeBuffer(LPVOID buffer);
#define MAPIFreeBuffer MsOutlookAddrBook_mapiFreeBuffer
HRESULT MsOutlookAddrBook_mapiLogonEx
(ULONG_PTR uiParam,
LPTSTR profileName, LPTSTR password,
FLAGS flags,
LPMAPISESSION FAR *mapiSession);
#define MAPILogonEx MsOutlookAddrBook_mapiLogonEx
HRESULT MsOutlookAddrBookContactSourceService_MAPIInitialize
(jlong version, jlong flags);
HRESULT MsOutlookAddrBookContactSourceService_MAPIInitializeCOMServer(void);
void MsOutlookAddrBookContactSourceService_MAPIUninitialize(void);
void MsOutlookAddrBookContactSourceService_MAPIUninitializeCOMServer(void);
HRESULT MsOutlookAddrBookContactSourceService_NativeMAPIInitialize
(jlong version, jlong flags,
void * deletedMethod, void * insertedMethod, void * updatedMethod);
void MsOutlookAddrBookContactSourceService_NativeMAPIUninitialize(void);
#endif

@ -1,26 +1,26 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
#include <jni.h>
#include <Mapix.h>
#include <tchar.h>
#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */
void MsOutlookMAPIHResultException_throwNew
(JNIEnv *jniEnv, HRESULT hResult, LPCSTR file, ULONG line);
#ifdef __cplusplus
}
#endif /* #ifdef __cplusplus */
#endif /* _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_ */
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
#include <jni.h>
#include <Mapix.h>
#include <tchar.h>
#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */
void MsOutlookMAPIHResultException_throwNew
(JNIEnv *jniEnv, HRESULT hResult, LPCSTR file, ULONG line);
#ifdef __cplusplus
}
#endif /* #ifdef __cplusplus */
#endif /* _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_ */

@ -1,208 +1,208 @@
/* 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
*/
/* Compiler settings for IMsOutlookAddrBookClient.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
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) = 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] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IMsOutlookAddrBookClient * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IMsOutlookAddrBookClient * This);
HRESULT ( STDMETHODCALLTYPE *foreachMailUserCallback )(
IMsOutlookAddrBookClient * This,
/* [in] */ BSTR id);
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) \
( (This)->lpVtbl -> foreachMailUserCallback(This,id) )
#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 8.00.0595 */
/* at Tue May 07 03:41:40 2013
*/
/* Compiler settings for IMsOutlookAddrBookClient.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
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) = 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] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IMsOutlookAddrBookClient * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IMsOutlookAddrBookClient * This);
HRESULT ( STDMETHODCALLTYPE *foreachMailUserCallback )(
IMsOutlookAddrBookClient * This,
/* [in] */ BSTR id);
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) \
( (This)->lpVtbl -> foreachMailUserCallback(This,id) )
#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

@ -1,251 +1,265 @@
/* 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:42 2013
*/
/* Compiler settings for IMsOutlookAddrBookServer.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
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 __IMsOutlookAddrBookServer_h__
#define __IMsOutlookAddrBookServer_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IMsOutlookAddrBookServer_FWD_DEFINED__
#define __IMsOutlookAddrBookServer_FWD_DEFINED__
typedef interface IMsOutlookAddrBookServer IMsOutlookAddrBookServer;
#endif /* __IMsOutlookAddrBookServer_FWD_DEFINED__ */
#ifndef __IMsOutlookAddrBookServer_FWD_DEFINED__
#define __IMsOutlookAddrBookServer_FWD_DEFINED__
typedef interface IMsOutlookAddrBookServer IMsOutlookAddrBookServer;
#endif /* __IMsOutlookAddrBookServer_FWD_DEFINED__ */
/* header files for imported files */
#include "Unknwn.h"
#include "oaidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IMsOutlookAddrBookServer_INTERFACE_DEFINED__
#define __IMsOutlookAddrBookServer_INTERFACE_DEFINED__
/* interface IMsOutlookAddrBookServer */
/* [oleautomation][dual][uuid][object] */
EXTERN_C const IID IID_IMsOutlookAddrBookServer;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5DDE9FF0-AC48-11E2-9E96-0800200C9A66")
IMsOutlookAddrBookServer : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE foreachMailUser(
/* [in] */ BSTR query) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_GetProps(
/* [in] */ BSTR entryId,
/* [in] */ int nbPropIds,
/* [in] */ SAFEARRAY * propIds,
/* [in] */ long flags,
/* [out] */ SAFEARRAY * *props,
/* [out] */ SAFEARRAY * *propsLength,
/* [out] */ SAFEARRAY * *propsType) = 0;
virtual HRESULT STDMETHODCALLTYPE createContact(
/* [out] */ BSTR *id) = 0;
virtual HRESULT STDMETHODCALLTYPE deleteContact(
/* [in] */ BSTR id) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_DeleteProp(
/* [in] */ long propId,
/* [in] */ BSTR entryId) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_SetPropString(
/* [in] */ long propId,
/* [in] */ BSTR value,
/* [in] */ BSTR entryId) = 0;
};
#else /* C style interface */
typedef struct IMsOutlookAddrBookServerVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IMsOutlookAddrBookServer * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IMsOutlookAddrBookServer * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IMsOutlookAddrBookServer * This);
HRESULT ( STDMETHODCALLTYPE *foreachMailUser )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR query);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_GetProps )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR entryId,
/* [in] */ int nbPropIds,
/* [in] */ SAFEARRAY * propIds,
/* [in] */ long flags,
/* [out] */ SAFEARRAY * *props,
/* [out] */ SAFEARRAY * *propsLength,
/* [out] */ SAFEARRAY * *propsType);
HRESULT ( STDMETHODCALLTYPE *createContact )(
IMsOutlookAddrBookServer * This,
/* [out] */ BSTR *id);
HRESULT ( STDMETHODCALLTYPE *deleteContact )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR id);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_DeleteProp )(
IMsOutlookAddrBookServer * This,
/* [in] */ long propId,
/* [in] */ BSTR entryId);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_SetPropString )(
IMsOutlookAddrBookServer * This,
/* [in] */ long propId,
/* [in] */ BSTR value,
/* [in] */ BSTR entryId);
END_INTERFACE
} IMsOutlookAddrBookServerVtbl;
interface IMsOutlookAddrBookServer
{
CONST_VTBL struct IMsOutlookAddrBookServerVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IMsOutlookAddrBookServer_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IMsOutlookAddrBookServer_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IMsOutlookAddrBookServer_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IMsOutlookAddrBookServer_foreachMailUser(This,query) \
( (This)->lpVtbl -> foreachMailUser(This,query) )
#define IMsOutlookAddrBookServer_IMAPIProp_GetProps(This,entryId,nbPropIds,propIds,flags,props,propsLength,propsType) \
( (This)->lpVtbl -> IMAPIProp_GetProps(This,entryId,nbPropIds,propIds,flags,props,propsLength,propsType) )
#define IMsOutlookAddrBookServer_createContact(This,id) \
( (This)->lpVtbl -> createContact(This,id) )
#define IMsOutlookAddrBookServer_deleteContact(This,id) \
( (This)->lpVtbl -> deleteContact(This,id) )
#define IMsOutlookAddrBookServer_IMAPIProp_DeleteProp(This,propId,entryId) \
( (This)->lpVtbl -> IMAPIProp_DeleteProp(This,propId,entryId) )
#define IMsOutlookAddrBookServer_IMAPIProp_SetPropString(This,propId,value,entryId) \
( (This)->lpVtbl -> IMAPIProp_SetPropString(This,propId,value,entryId) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IMsOutlookAddrBookServer_INTERFACE_DEFINED__ */
#ifndef __IMsOutlookAddrBookServerTypeLib_LIBRARY_DEFINED__
#define __IMsOutlookAddrBookServerTypeLib_LIBRARY_DEFINED__
/* library IMsOutlookAddrBookServerTypeLib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_IMsOutlookAddrBookServerTypeLib;
#endif /* __IMsOutlookAddrBookServerTypeLib_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 * );
unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
/* 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
*/
/* Compiler settings for IMsOutlookAddrBookServer.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595
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 __IMsOutlookAddrBookServer_h__
#define __IMsOutlookAddrBookServer_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __IMsOutlookAddrBookServer_FWD_DEFINED__
#define __IMsOutlookAddrBookServer_FWD_DEFINED__
typedef interface IMsOutlookAddrBookServer IMsOutlookAddrBookServer;
#endif /* __IMsOutlookAddrBookServer_FWD_DEFINED__ */
#ifndef __IMsOutlookAddrBookServer_FWD_DEFINED__
#define __IMsOutlookAddrBookServer_FWD_DEFINED__
typedef interface IMsOutlookAddrBookServer IMsOutlookAddrBookServer;
#endif /* __IMsOutlookAddrBookServer_FWD_DEFINED__ */
/* header files for imported files */
#include "Unknwn.h"
#include "oaidl.h"
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IMsOutlookAddrBookServer_INTERFACE_DEFINED__
#define __IMsOutlookAddrBookServer_INTERFACE_DEFINED__
/* interface IMsOutlookAddrBookServer */
/* [oleautomation][dual][uuid][object] */
EXTERN_C const IID IID_IMsOutlookAddrBookServer;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5DDE9FF0-AC48-11E2-9E96-0800200C9A66")
IMsOutlookAddrBookServer : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE foreachMailUser(
/* [in] */ BSTR query) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_GetProps(
/* [in] */ BSTR entryId,
/* [in] */ int nbPropIds,
/* [in] */ SAFEARRAY * propIds,
/* [in] */ long flags,
/* [out] */ SAFEARRAY * *props,
/* [out] */ SAFEARRAY * *propsLength,
/* [out] */ SAFEARRAY * *propsType) = 0;
virtual HRESULT STDMETHODCALLTYPE createContact(
/* [out] */ BSTR *id) = 0;
virtual HRESULT STDMETHODCALLTYPE deleteContact(
/* [in] */ BSTR id) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_DeleteProp(
/* [in] */ long propId,
/* [in] */ BSTR entryId) = 0;
virtual HRESULT STDMETHODCALLTYPE IMAPIProp_SetPropString(
/* [in] */ long propId,
/* [in] */ BSTR value,
/* [in] */ BSTR entryId) = 0;
virtual HRESULT STDMETHODCALLTYPE compareEntryIds(
/* [in] */ BSTR id1,
/* [in] */ BSTR id2,
/* [out] */ int *result) = 0;
};
#else /* C style interface */
typedef struct IMsOutlookAddrBookServerVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IMsOutlookAddrBookServer * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IMsOutlookAddrBookServer * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IMsOutlookAddrBookServer * This);
HRESULT ( STDMETHODCALLTYPE *foreachMailUser )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR query);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_GetProps )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR entryId,
/* [in] */ int nbPropIds,
/* [in] */ SAFEARRAY * propIds,
/* [in] */ long flags,
/* [out] */ SAFEARRAY * *props,
/* [out] */ SAFEARRAY * *propsLength,
/* [out] */ SAFEARRAY * *propsType);
HRESULT ( STDMETHODCALLTYPE *createContact )(
IMsOutlookAddrBookServer * This,
/* [out] */ BSTR *id);
HRESULT ( STDMETHODCALLTYPE *deleteContact )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR id);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_DeleteProp )(
IMsOutlookAddrBookServer * This,
/* [in] */ long propId,
/* [in] */ BSTR entryId);
HRESULT ( STDMETHODCALLTYPE *IMAPIProp_SetPropString )(
IMsOutlookAddrBookServer * This,
/* [in] */ long propId,
/* [in] */ BSTR value,
/* [in] */ BSTR entryId);
HRESULT ( STDMETHODCALLTYPE *compareEntryIds )(
IMsOutlookAddrBookServer * This,
/* [in] */ BSTR id1,
/* [in] */ BSTR id2,
/* [out] */ int *result);
END_INTERFACE
} IMsOutlookAddrBookServerVtbl;
interface IMsOutlookAddrBookServer
{
CONST_VTBL struct IMsOutlookAddrBookServerVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IMsOutlookAddrBookServer_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IMsOutlookAddrBookServer_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IMsOutlookAddrBookServer_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IMsOutlookAddrBookServer_foreachMailUser(This,query) \
( (This)->lpVtbl -> foreachMailUser(This,query) )
#define IMsOutlookAddrBookServer_IMAPIProp_GetProps(This,entryId,nbPropIds,propIds,flags,props,propsLength,propsType) \
( (This)->lpVtbl -> IMAPIProp_GetProps(This,entryId,nbPropIds,propIds,flags,props,propsLength,propsType) )
#define IMsOutlookAddrBookServer_createContact(This,id) \
( (This)->lpVtbl -> createContact(This,id) )
#define IMsOutlookAddrBookServer_deleteContact(This,id) \
( (This)->lpVtbl -> deleteContact(This,id) )
#define IMsOutlookAddrBookServer_IMAPIProp_DeleteProp(This,propId,entryId) \
( (This)->lpVtbl -> IMAPIProp_DeleteProp(This,propId,entryId) )
#define IMsOutlookAddrBookServer_IMAPIProp_SetPropString(This,propId,value,entryId) \
( (This)->lpVtbl -> IMAPIProp_SetPropString(This,propId,value,entryId) )
#define IMsOutlookAddrBookServer_compareEntryIds(This,id1,id2,result) \
( (This)->lpVtbl -> compareEntryIds(This,id1,id2,result) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IMsOutlookAddrBookServer_INTERFACE_DEFINED__ */
#ifndef __IMsOutlookAddrBookServerTypeLib_LIBRARY_DEFINED__
#define __IMsOutlookAddrBookServerTypeLib_LIBRARY_DEFINED__
/* library IMsOutlookAddrBookServerTypeLib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_IMsOutlookAddrBookServerTypeLib;
#endif /* __IMsOutlookAddrBookServerTypeLib_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 * );
unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

@ -36,6 +36,11 @@ interface IMsOutlookAddrBookServer : IUnknown
[in] long propId,
[in] BSTR value,
[in] BSTR entryId);
HRESULT compareEntryIds(
[in] BSTR id1,
[in] BSTR id2,
[out] int *result);
};

@ -128,6 +128,9 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::foreachMailUserCallback(
HRESULT STDMETHODCALLTYPE MsOutlookAddrBookClient::deleted(BSTR id)
{
char * charId = StringUtils::WideCharToMultiByte(id);
fprintf(stdout, "MsOutlookAddrBookClient_deleted: id: %s\n",
charId);
fflush(stdout);
MAPINotification_jniCallDeletedMethod(charId);
free(charId);

@ -366,3 +366,34 @@ HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::IMAPIProp_SetPropString(
}
return hr;
}
/**
* Compares two identifiers to determine if they are part of the same
* Outlook contact.
*
* @param id1 The first identifier.
* @param id2 The second identifier.
* @param result A boolean set to true if id1 and id2 are two identifiers of the
* same contact. False otherwise.
*
* @return S_OK if eveything works fine. E_FAIL otherwise.
*/
HRESULT STDMETHODCALLTYPE MsOutlookAddrBookServer::compareEntryIds(
BSTR id1,
BSTR id2,
int * result)
{
HRESULT hr = E_FAIL;
if(id1 != NULL && id2 != NULL)
{
LPSTR nativeId1 = StringUtils::WideCharToMultiByte(id1);
LPSTR nativeId2 = StringUtils::WideCharToMultiByte(id2);
(*result) = MsOutlookAddrBookContactQuery_compareEntryIds(
nativeId1,
nativeId2);
hr = S_OK;
free(nativeId1);
free(nativeId2);
}
return hr;
}

@ -61,6 +61,11 @@ class MsOutlookAddrBookServer:
BSTR value,
BSTR entryId);
HRESULT STDMETHODCALLTYPE compareEntryIds(
BSTR id1,
BSTR id2,
int *result);
protected:
virtual ~MsOutlookAddrBookServer();

@ -125,6 +125,9 @@ void waitParentProcessStop()
static void Server_deleted(LPSTR id)
{
HRESULT hr = E_FAIL;
fprintf(stdout, "Server_deleted: id: %s\n",
id);
fflush(stdout);
IMsOutlookAddrBookClient * msOutlookAddrBookClient = NULL;
if((hr = CoCreateInstance(

@ -420,3 +420,56 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac
return javaProps;
}
/**
* Compares two identifiers to determine if they are part of the same
* Outlook contact.
*
* @param jniEnv The Java native interface environment.
* @param clazz A Java class Object.
* @param id1 The first identifier.
* @param id2 The second identifier.
*
* @return True if id1 and id2 are two identifiers of the same contact.
* False otherwise.
*/
JNIEXPORT jboolean JNICALL
Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_compareEntryIds
(JNIEnv *jniEnv, jclass clazz, jstring id1, jstring id2)
{
jboolean res = JNI_FALSE;
if(id1 == NULL || id2 == NULL)
{
return res;
}
const char *nativeId1 = jniEnv->GetStringUTFChars(id1, NULL);
const char *nativeId2 = jniEnv->GetStringUTFChars(id2, NULL);
IMsOutlookAddrBookServer * iServer = ComClient_getIServer();
if(iServer)
{
LPWSTR unicodeId1 = StringUtils::MultiByteToWideChar(nativeId1);
LPWSTR unicodeId2 = StringUtils::MultiByteToWideChar(nativeId2);
BSTR comId1 = SysAllocString(unicodeId1);
BSTR comId2 = SysAllocString(unicodeId2);
int result = 0;
if(iServer->compareEntryIds(comId1, comId2, &result) == S_OK)
{
res = (result == 1);
}
SysFreeString(comId1);
SysFreeString(comId2);
free(unicodeId1);
free(unicodeId2);
}
jniEnv->ReleaseStringUTFChars(id1, nativeId1);
jniEnv->ReleaseStringUTFChars(id2, nativeId2);
return res;
}

@ -37,6 +37,10 @@ JNIEXPORT jobjectArray JNICALL Java_net_java_sip_communicator_plugin_addrbook_ms
JNIEXPORT jboolean JNICALL Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_IMAPIProp_1SetPropString
(JNIEnv *, jclass, jlong, jstring, jstring);
JNIEXPORT jboolean JNICALL
Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery_compareEntryIds
(JNIEnv *, jclass, jstring, jstring);
#ifdef __cplusplus
}
#endif

@ -1,47 +1,46 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
#include "MsOutlookAddrBookContactSourceService.h"
#include "MsOutlookMAPIHResultException.h"
#include "MAPINotification.h"
#include "MAPIBitness.h"
JNIEXPORT void JNICALL
Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIInitialize
(JNIEnv *jniEnv, jclass clazz, jlong version, jlong flags,
jobject notificationsDelegate)
{
HRESULT hr;
MAPINotification_registerJniNotificationsDelegate(
jniEnv,
notificationsDelegate);
hr = MsOutlookAddrBookContactSourceService_MAPIInitializeCOMServer();
if (HR_FAILED(hr))
{
// Report any possible error regardless of where it has come from.
MsOutlookMAPIHResultException_throwNew(
jniEnv,
hr,
__FILE__, __LINE__);
}
}
JNIEXPORT void JNICALL
Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIUninitialize
(JNIEnv *jniEnv, jclass clazz)
{
MAPINotification_unregisterJniNotificationsDelegate(jniEnv);
MsOutlookAddrBookContactSourceService_MAPIUninitializeCOMServer();
}
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
#include "MsOutlookAddrBookContactSourceService.h"
#include "MsOutlookMAPIHResultException.h"
#include "MAPINotification.h"
#include "MAPIBitness.h"
JNIEXPORT void JNICALL
Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIInitialize
(JNIEnv *jniEnv, jclass clazz, jlong version, jlong flags,
jobject notificationsDelegate)
{
HRESULT hr;
MAPINotification_registerJniNotificationsDelegate(
jniEnv,
notificationsDelegate);
hr = MsOutlookAddrBookContactSourceService_MAPIInitializeCOMServer();
if (HR_FAILED(hr))
{
// Report any possible error regardless of where it has come from.
MsOutlookMAPIHResultException_throwNew(
jniEnv,
hr,
__FILE__, __LINE__);
}
}
JNIEXPORT void JNICALL
Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService_MAPIUninitialize
(JNIEnv *jniEnv, jclass clazz)
{
MAPINotification_unregisterJniNotificationsDelegate(jniEnv);
MsOutlookAddrBookContactSourceService_MAPIUninitializeCOMServer();
}

@ -1,31 +1,31 @@
/* 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
*/
/* 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, jobject);
/*
* 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
(JNIEnv *, jclass, jlong, jlong, jobject);
/*
* 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

@ -1,273 +1,273 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.addrbook;
import java.util.*;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.jitsi.util.*;
import org.osgi.framework.*;
/**
* Implements <tt>BundleActivator</tt> for the addrbook plug-in which provides
* support for OS-specific Address Book.
*
* @author Lyubomir Marinov
*/
public class AddrBookActivator
implements BundleActivator
{
/**
* Boolean property that defines whether the integration of the Outlook
* address book is enabled.
*/
public static final String PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH =
"plugin.addrbook.ENABLE_MICROSOFT_OUTLOOK_SEARCH";
/**
* Boolean property that defines whether the integration of the OS X
* address book is enabled.
*/
public static final String PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH =
"plugin.addrbook.ENABLE_MACOSX_ADDRESS_BOOK_SEARCH";
/**
* The <tt>Logger</tt> used by the <tt>AddrBookActivator</tt> class and its
* instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(AddrBookActivator.class);
/**
* The <tt>BundleContext</tt> in which the addrbook plug-in is started.
*/
private static BundleContext bundleContext;
/**
* The <tt>ContactSourceService</tt> implementation for the OS-specific
* Address Book.
*/
private static ContactSourceService css;
/**
* The <tt>ServiceRegistration</tt> of {@link #css} in the
* <tt>BundleContext</tt> in which this <tt>AddrBookActivator</tt> has been
* started.
*/
private static ServiceRegistration cssServiceRegistration;
/**
* The <tt>ResourceManagementService</tt> through which we access resources.
*/
private static ResourceManagementService resourceService;
/**
* The <tt>ConfigurationService</tt> through which we access configuration
* properties.
*/
private static ConfigurationService configService;
/**
* Gets the <tt>ResourceManagementService</tt> to be used by the
* functionality of the addrbook plug-in.
*
* @return the <tt>ResourceManagementService</tt> to be used by the
* functionality of the addrbook plug-in
*/
public static ResourceManagementService getResources()
{
if (resourceService == null)
{
resourceService
= ServiceUtils.getService(
bundleContext,
ResourceManagementService.class);
}
return resourceService;
}
/**
* Gets the <tt>ConfigurationService</tt> to be used by the
* functionality of the addrbook plug-in.
*
* @return the <tt>ConfigurationService</tt> to be used by the
* functionality of the addrbook plug-in
*/
public static ConfigurationService getConfigService()
{
if (configService == null)
{
configService
= ServiceUtils.getService(
bundleContext,
ConfigurationService.class);
}
return configService;
}
/**
* Starts the addrbook plug-in.
*
* @param bundleContext the <tt>BundleContext</tt> in which the addrbook
* plug-in is to be started
* @throws Exception if anything goes wrong while starting the addrbook
* plug-in
* @see BundleActivator#start(BundleContext)
*/
public void start(BundleContext bundleContext)
throws Exception
{
if (logger.isInfoEnabled())
logger.info("Address book \""
+ "plugin.addrbook.ADDRESS_BOOKS"
+ "\" ... [STARTED]");
AddrBookActivator.bundleContext = bundleContext;
Dictionary<String, String> properties = new Hashtable<String, String>();
// Registers the sip config panel as advanced configuration form.
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.CONTACT_SOURCE_TYPE);
bundleContext.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
AdvancedConfigForm.class.getName(),
getClass().getClassLoader(),
null,
"plugin.addrbook.ADDRESS_BOOKS",
101, false),
properties);
startService();
}
/**
* Stops the addrbook plug-in.
*
* @param bundleContext the <tt>BundleContext</tt> in which the addrbook
* plug-in is to be stopped
* @throws Exception if anything goes wrong while stopping the addrbook
* plug-in
* @see BundleActivator#stop(BundleContext)
*/
public void stop(BundleContext bundleContext)
throws Exception
{
if (logger.isInfoEnabled())
logger.info("Address book \""
+ "plugin.addrbook.ADDRESS_BOOKS"
+ "\" ... [STOPPED]");
stopService();
}
/**
* Starts the address book service.
*/
static void startService()
{
/* Register the ContactSourceService implementation (if any). */
String cssClassName;
if (OSUtils.IS_WINDOWS
&& getConfigService().getBoolean(
PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH, true))
{
cssClassName
= "net.java.sip.communicator.plugin.addrbook"
+ ".msoutlook.MsOutlookAddrBookContactSourceService";
}
else if (OSUtils.IS_MAC
&& getConfigService().getBoolean(
PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH, true))
{
cssClassName
= "net.java.sip.communicator.plugin.addrbook"
+ ".macosx.MacOSXAddrBookContactSourceService";
}
else
return;
try
{
css
= (ContactSourceService)
Class.forName(cssClassName).newInstance();
}
catch (Exception ex)
{
logger.error("Failed to instantiate " + cssClassName + " reason:"
+ ex.getMessage());
if(logger.isDebugEnabled())
logger.debug("Failed to instantiate " + cssClassName, ex);
return;
}
try
{
cssServiceRegistration
= bundleContext.registerService(
ContactSourceService.class.getName(),
css,
null);
}
finally
{
if (cssServiceRegistration == null)
{
if (css instanceof AsyncContactSourceService)
((AsyncContactSourceService) css).stop();
css = null;
}
else
{
if (logger.isInfoEnabled())
logger.info("Address book \""
+ css.getDisplayName()
+ "\" ... [REGISTERED]");
}
}
}
/**
* Stop the previously registered service.
*/
static void stopService()
{
try
{
if (cssServiceRegistration != null)
{
cssServiceRegistration.unregister();
cssServiceRegistration = null;
}
}
finally
{
if (css != null)
{
if (css instanceof AsyncContactSourceService)
((AsyncContactSourceService) css).stop();
if (logger.isInfoEnabled())
logger.info("Address book \""
+ css.getDisplayName()
+ "\" ... [UNREGISTERED]");
css = null;
}
}
}
}
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.addrbook;
import java.util.*;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.jitsi.util.*;
import org.osgi.framework.*;
/**
* Implements <tt>BundleActivator</tt> for the addrbook plug-in which provides
* support for OS-specific Address Book.
*
* @author Lyubomir Marinov
*/
public class AddrBookActivator
implements BundleActivator
{
/**
* Boolean property that defines whether the integration of the Outlook
* address book is enabled.
*/
public static final String PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH =
"plugin.addrbook.ENABLE_MICROSOFT_OUTLOOK_SEARCH";
/**
* Boolean property that defines whether the integration of the OS X
* address book is enabled.
*/
public static final String PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH =
"plugin.addrbook.ENABLE_MACOSX_ADDRESS_BOOK_SEARCH";
/**
* The <tt>Logger</tt> used by the <tt>AddrBookActivator</tt> class and its
* instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(AddrBookActivator.class);
/**
* The <tt>BundleContext</tt> in which the addrbook plug-in is started.
*/
private static BundleContext bundleContext;
/**
* The <tt>ContactSourceService</tt> implementation for the OS-specific
* Address Book.
*/
private static ContactSourceService css;
/**
* The <tt>ServiceRegistration</tt> of {@link #css} in the
* <tt>BundleContext</tt> in which this <tt>AddrBookActivator</tt> has been
* started.
*/
private static ServiceRegistration cssServiceRegistration;
/**
* The <tt>ResourceManagementService</tt> through which we access resources.
*/
private static ResourceManagementService resourceService;
/**
* The <tt>ConfigurationService</tt> through which we access configuration
* properties.
*/
private static ConfigurationService configService;
/**
* Gets the <tt>ResourceManagementService</tt> to be used by the
* functionality of the addrbook plug-in.
*
* @return the <tt>ResourceManagementService</tt> to be used by the
* functionality of the addrbook plug-in
*/
public static ResourceManagementService getResources()
{
if (resourceService == null)
{
resourceService
= ServiceUtils.getService(
bundleContext,
ResourceManagementService.class);
}
return resourceService;
}
/**
* Gets the <tt>ConfigurationService</tt> to be used by the
* functionality of the addrbook plug-in.
*
* @return the <tt>ConfigurationService</tt> to be used by the
* functionality of the addrbook plug-in
*/
public static ConfigurationService getConfigService()
{
if (configService == null)
{
configService
= ServiceUtils.getService(
bundleContext,
ConfigurationService.class);
}
return configService;
}
/**
* Starts the addrbook plug-in.
*
* @param bundleContext the <tt>BundleContext</tt> in which the addrbook
* plug-in is to be started
* @throws Exception if anything goes wrong while starting the addrbook
* plug-in
* @see BundleActivator#start(BundleContext)
*/
public void start(BundleContext bundleContext)
throws Exception
{
if (logger.isInfoEnabled())
logger.info("Address book \""
+ "plugin.addrbook.ADDRESS_BOOKS"
+ "\" ... [STARTED]");
AddrBookActivator.bundleContext = bundleContext;
Dictionary<String, String> properties = new Hashtable<String, String>();
// Registers the sip config panel as advanced configuration form.
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.CONTACT_SOURCE_TYPE);
bundleContext.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
AdvancedConfigForm.class.getName(),
getClass().getClassLoader(),
null,
"plugin.addrbook.ADDRESS_BOOKS",
101, false),
properties);
startService();
}
/**
* Stops the addrbook plug-in.
*
* @param bundleContext the <tt>BundleContext</tt> in which the addrbook
* plug-in is to be stopped
* @throws Exception if anything goes wrong while stopping the addrbook
* plug-in
* @see BundleActivator#stop(BundleContext)
*/
public void stop(BundleContext bundleContext)
throws Exception
{
if (logger.isInfoEnabled())
logger.info("Address book \""
+ "plugin.addrbook.ADDRESS_BOOKS"
+ "\" ... [STOPPED]");
stopService();
}
/**
* Starts the address book service.
*/
static void startService()
{
/* Register the ContactSourceService implementation (if any). */
String cssClassName;
if (OSUtils.IS_WINDOWS
&& getConfigService().getBoolean(
PNAME_ENABLE_MICROSOFT_OUTLOOK_SEARCH, true))
{
cssClassName
= "net.java.sip.communicator.plugin.addrbook"
+ ".msoutlook.MsOutlookAddrBookContactSourceService";
}
else if (OSUtils.IS_MAC
&& getConfigService().getBoolean(
PNAME_ENABLE_MACOSX_ADDRESS_BOOK_SEARCH, true))
{
cssClassName
= "net.java.sip.communicator.plugin.addrbook"
+ ".macosx.MacOSXAddrBookContactSourceService";
}
else
return;
try
{
css
= (ContactSourceService)
Class.forName(cssClassName).newInstance();
}
catch (Exception ex)
{
logger.error("Failed to instantiate " + cssClassName + " reason:"
+ ex.getMessage());
if(logger.isDebugEnabled())
logger.debug("Failed to instantiate " + cssClassName, ex);
return;
}
try
{
cssServiceRegistration
= bundleContext.registerService(
ContactSourceService.class.getName(),
css,
null);
}
finally
{
if (cssServiceRegistration == null)
{
if (css instanceof AsyncContactSourceService)
((AsyncContactSourceService) css).stop();
css = null;
}
else
{
if (logger.isInfoEnabled())
logger.info("Address book \""
+ css.getDisplayName()
+ "\" ... [REGISTERED]");
}
}
}
/**
* Stop the previously registered service.
*/
static void stopService()
{
try
{
if (cssServiceRegistration != null)
{
cssServiceRegistration.unregister();
cssServiceRegistration = null;
}
}
finally
{
if (css != null)
{
if (css instanceof AsyncContactSourceService)
((AsyncContactSourceService) css).stop();
if (logger.isInfoEnabled())
logger.info("Address book \""
+ css.getDisplayName()
+ "\" ... [UNREGISTERED]");
css = null;
}
}
}
}

@ -362,7 +362,7 @@ public class MsOutlookAddrBookContactQuery
/**
* Boolea used to defined if we already get and logged a read contact
* property error.
* property error.
*/
private boolean firstIMAPIPropGetPropFailureLogged = false;
@ -758,6 +758,18 @@ public static native boolean IMAPIProp_DeleteProp(
*/
public static native String createContact();
/**
* Compares two identifiers to determine if they are part of the same
* Outlook contact.
*
* @param id1 The first identifier.
* @param id2 The second identifier.
*
* @return True if id1 and id2 are two identifiers of the same contact.
* False otherwise.
*/
public static native boolean compareEntryIds(String id1, String id2);
/**
* Determines whether a specific index in {@link #MAPI_MAILUSER_PROP_IDS}
* stands for a property with a phone number value.
@ -814,11 +826,6 @@ private boolean matches(int property, String value)
private boolean onMailUser(String id)
throws MsOutlookMAPIHResultException
{
if(logger.isDebugEnabled())
{
logger.debug("Found contact id: " + id);
}
Object[] props = null;
try
{
@ -1063,6 +1070,10 @@ public void updated(String id)
((MsOutlookAddrBookSourceContact) sourceContact).updated();
fireContactChanged(sourceContact);
}
else
{
inserted(id);
}
}
/**
@ -1203,4 +1214,27 @@ public static String getOrganization(Object[] values)
{
return (String) values[PR_COMPANY_NAME];
}
/**
* Searches for source contact with the specified id.
* @param id the id to search for
* @return the source contact found or null.
*/
protected SourceContact findSourceContactByID(String id)
{
synchronized(sourceContacts)
{
for(SourceContact sc : sourceContacts)
{
Object scID = sc.getData(SourceContact.DATA_ID);
if(id.equals(scID)
|| compareEntryIds(id, (String) scID))
return sc;
}
}
// not found
return null;
}
}

Loading…
Cancel
Save