Sample code for 30+ languages & platforms
C++

Transition from Imap.ThreadCmd to Imap.QueryThread

Provides instructions for replacing deprecated ThreadCmd method calls with QueryThread.

Chilkat C++ Downloads

C++
#include <CkImap.h>
#include <CkJsonObject.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkImap imap;

    //  ...
    //  ...

    const char *threadAlg = "REFERENCES";
    const char *charset = "UTF-8";
    const char *searchCriteria = "SUBJECT a";
    bool bUid = true;

    //  ------------------------------------------------------------------------
    //  The ThreadCmd method is deprecated:

    CkJsonObject *jsonObj = imap.ThreadCmd(threadAlg,charset,searchCriteria,bUid);
    if (imap.get_LastMethodSuccess() == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }

    //  ...
    //  ...

    delete jsonObj;

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

    imap.put_SearchCharset("UTF-8");

    CkJsonObject json;
    success = imap.QueryThread(threadAlg,searchCriteria,bUid,json);
    if (success == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }
    }