Reorders the code for Oulook COM server to register earlier and increases

the tries to connect to the COM server in the COM client.
fix-message-formatting 5243
hristoterezov 12 years ago
parent 527417062c
commit d31437db4d

@ -910,7 +910,8 @@ ULONG MAPINotification_registerNotifyMessageDataBase(
ULONG nbConnection = 0;
if (HR_SUCCEEDED(hResult))
{
MsOutlookUtils_log(
"Successfully found folder to register notifications.");
iUnknown->Advise(
(ULONG) entrySize,
(LPENTRYID) entryID,
@ -918,6 +919,19 @@ ULONG MAPINotification_registerNotifyMessageDataBase(
*adviseSink,
(ULONG *) &nbConnection);
}
else
{
if(type == CONTACTS_FOLDER_TYPE)
{
MsOutlookUtils_log(
"Contacts folder for the message store doesn't exists");
}
else
{
MsOutlookUtils_log(
"Calendar folder for the message store doesn't exists");
}
}
return nbConnection;
}

@ -49,9 +49,9 @@ void ComClient_start(void)
if((hr = CoInitializeEx(NULL, COINIT_MULTITHREADED)) == S_OK
|| hr == S_FALSE)
{
// The server may be long to start, then retry 10 times with 1s pause
// The server may be long to start, then retry 20 times with 1s pause
// between each try.
int retry = 10;
int retry = 20;
while(retry > 0)
{
if((hr = CoCreateInstance(

@ -61,22 +61,7 @@ int main(int argc, char** argv)
return hr;
}
MAPISession_initLock();
if(MsOutlookAddrBookContactSourceService_NativeMAPIInitialize(
MAPI_INIT_VERSION,
MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT,
(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);
@ -91,8 +76,27 @@ int main(int argc, char** argv)
hr = classObject->registerClassObject();
hr = ::CoResumeClassObjects();
MsOutlookUtils_logInfo("Server started.");
waitParentProcessStop();
if(MsOutlookAddrBookContactSourceService_NativeMAPIInitialize(
MAPI_INIT_VERSION,
MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT,
(void*) Server_contactDeleted,
(void*) Server_contactInserted,
(void*) Server_contactUpdated)
!= S_OK)
{
MsOutlookUtils_logInfo("Error in native MAPI initialization of the Outlook Server.[2]");
CoUninitialize();
}
else
{
MAPINotification_registerCalendarNativeNotificationsDelegate(
(void*) Server_calendarDeleted,
(void*) Server_calendarInserted,
(void*) Server_calendarUpdated);
MsOutlookUtils_logInfo("Server started.");
waitParentProcessStop();
}
MsOutlookUtils_logInfo("Stop waiting.[3]");
hr = ::CoSuspendClassObjects();

Loading…
Cancel
Save