Sample code for 30+ languages & platforms
PureBasic Requires Chilkat v11.0.0+

Transition from Imap.ThreadCmd to Imap.QueryThread

Provides instructions for replacing deprecated ThreadCmd method calls with QueryThread.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkImap.pb"
IncludeFile "CkJsonObject.pb"

Procedure ChilkatExample()

    success.i = 0

    imap.i = CkImap::ckCreate()
    If imap.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ;  ...
    ;  ...

    threadAlg.s = "REFERENCES"
    charset.s = "UTF-8"
    searchCriteria.s = "SUBJECT a"
    bUid.i = 1

    ;  ------------------------------------------------------------------------
    ;  The ThreadCmd method is deprecated:

    jsonObj.i = CkImap::ckThreadCmd(imap,threadAlg,charset,searchCriteria,bUid)
    If CkImap::ckLastMethodSuccess(imap) = 0
        Debug CkImap::ckLastErrorText(imap)
        CkImap::ckDispose(imap)
        ProcedureReturn
    EndIf

    ;  ...
    ;  ...

    CkJsonObject::ckDispose(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.

    CkImap::setCkSearchCharset(imap, "UTF-8")

    json.i = CkJsonObject::ckCreate()
    If json.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkImap::ckQueryThread(imap,threadAlg,searchCriteria,bUid,json)
    If success = 0
        Debug CkImap::ckLastErrorText(imap)
        CkImap::ckDispose(imap)
        CkJsonObject::ckDispose(json)
        ProcedureReturn
    EndIf



    CkImap::ckDispose(imap)
    CkJsonObject::ckDispose(json)


    ProcedureReturn
EndProcedure