hello,

On Wed, Apr 8, 2009 at 2:08 AM, Brad Hards <[email protected]> wrote:
> The patch looks fine, but it would be useful if we had a mapitest that showed
> the problem (i.e. shows the failure without the patch, and shows success with
> the patch). If you have time, can you write one?

Please find in attachment an example program that outline the issue.
Without the patch the Unsubscribe() call fails; with the patch applied
the program complete successfully.

Cheers,

Paolo
#include <string.h>
#include <stdio.h>
#include <libmapi/libmapi.h>

int cb(uint16_t type, void* data, void* priv)
{
}

int main(int argv, char* argc[])
{
        mapi_object_t store;
        char* prof =0;
        mapi_object_store_t* str;
        struct mapi_session* data=0;
        mapi_object_t sto2;
        uint32_t tcon;
        
        int i;
        printf("started\n");

        char profile[1024];
        strcpy(profile, getenv("HOME"));
        strcat(profile, "/.openchange/profiles.ldb");
        MAPIInitialize(profile);

        if (GetDefaultProfile(&prof) != MAPI_E_SUCCESS) {
                printf(" can't get default profile \n");
                return -1;
        }       

        if (MapiLogonEx(&data, prof, 0) != MAPI_E_SUCCESS) {
                printf("can't logon \n");
                return -1;
        }

        mapi_object_init(&store);
        if (OpenUserMailbox(data, 0, &store) != MAPI_E_SUCCESS) {
                printf("can't open msg store \n");
                return -1;
        }

        if (RegisterNotification(fnevObjectCopied) != MAPI_E_SUCCESS) {
                printf("can't register notification\n");
                return -1;
        }

        if (Subscribe(&store, &tcon, fnevObjectCopied, true, cb) != 
MAPI_E_SUCCESS) {
                printf("can't subscribe to store update \n");
                return -1;
        }

        printf("unsubscribe\n");
        if (Unsubscribe(data, tcon) != MAPI_E_SUCCESS) {
                printf("can't unsubscribe \n");
                return -1;
        }
        printf("finished\n");

        Logoff(&store);
        MAPIUninitialize();
        return 0;
}
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel

Reply via email to