Sample code for 30+ languages & platforms
C

Transition from Imap.CheckForNewEmail to Imap.QueryMbx

Provides instructions for replacing deprecated CheckForNewEmail method calls with QueryMbx.

Chilkat C Downloads

C
#include <C_CkImap.h>
#include <C_CkMessageSet.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkImap imap;
    HCkMessageSet msgSetObj;
    const char *criteria;
    BOOL bUid;
    HCkMessageSet msgSet;

    success = FALSE;

    imap = CkImap_Create();

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The CheckForNewEmail method is deprecated:

    msgSetObj = CkImap_CheckForNewEmail(imap);
    if (CkImap_getLastMethodSuccess(imap) == FALSE) {
        printf("%s\n",CkImap_lastErrorText(imap));
        CkImap_Dispose(imap);
        return;
    }

    //  ...
    //  ...

    CkMessageSet_Dispose(msgSetObj);

    //  ------------------------------------------------------------------------
    //  Do the equivalent using QueryMbx.
    //  Your application creates a new, empty MessageSet object which is passed 
    //  in the last argument and filled upon success.

    criteria = "new-email";
    bUid = TRUE;

    msgSet = CkMessageSet_Create();
    success = CkImap_QueryMbx(imap,criteria,bUid,msgSet);
    if (success == FALSE) {
        printf("%s\n",CkImap_lastErrorText(imap));
        CkImap_Dispose(imap);
        CkMessageSet_Dispose(msgSet);
        return;
    }



    CkImap_Dispose(imap);
    CkMessageSet_Dispose(msgSet);

    }