Sample code for 30+ languages & platforms
PureBasic

Transition from MailMan.FetchMultiple to MailMan.FetchUidlSet

Provides instructions for replacing deprecated FetchMultiple method calls with FetchUidlSet.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkStringTable.pb"
IncludeFile "CkMailMan.pb"
IncludeFile "CkEmailBundle.pb"
IncludeFile "CkStringArray.pb"

Procedure ChilkatExample()

    success.i = 0

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

    ; ...
    ; ...

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

    CkStringArray::ckAppend(saUidls,"aaa")
    CkStringArray::ckAppend(saUidls,"bbb")
    CkStringArray::ckAppend(saUidls,"ccc")

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

    CkStringTable::ckAppend(stUidls,"aaa")
    CkStringTable::ckAppend(stUidls,"bbb")
    CkStringTable::ckAppend(stUidls,"ccc")

    ; ------------------------------------------------------------------------
    ; The FetchMultiple method is deprecated:

    bundleObj.i = CkMailMan::ckFetchMultiple(mailman,saUidls)
    If CkMailMan::ckLastMethodSuccess(mailman) = 0
        Debug CkMailMan::ckLastErrorText(mailman)
        CkMailMan::ckDispose(mailman)
        CkStringArray::ckDispose(saUidls)
        CkStringTable::ckDispose(stUidls)
        ProcedureReturn
    EndIf

    ; ...
    ; ...

    CkEmailBundle::ckDispose(bundleObj)

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

    headersOnly.i = 0
    ; Irrelevant because we are not downloading headers-only.
    numBodyLines.i = 0

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

    success = CkMailMan::ckFetchUidlSet(mailman,stUidls,headersOnly,numBodyLines,bundleOut)
    If success = 0
        Debug CkMailMan::ckLastErrorText(mailman)
        CkMailMan::ckDispose(mailman)
        CkStringArray::ckDispose(saUidls)
        CkStringTable::ckDispose(stUidls)
        CkEmailBundle::ckDispose(bundleOut)
        ProcedureReturn
    EndIf



    CkMailMan::ckDispose(mailman)
    CkStringArray::ckDispose(saUidls)
    CkStringTable::ckDispose(stUidls)
    CkEmailBundle::ckDispose(bundleOut)


    ProcedureReturn
EndProcedure