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

Transition from Imap.ListSubscribed to Imap.MbxList

Provides instructions for replacing deprecated ListSubscribed method calls with MbxList.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkMailboxes.pb"
IncludeFile "CkImap.pb"

Procedure ChilkatExample()

    success.i = 0

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

    ;  ...
    ;  ...

    reference.s = ""
    mbxPattern.s = "*"

    ;  ------------------------------------------------------------------------
    ;  The ListSubscribed method is deprecated:

    ;  Lists only subscribed mailboxes.
    mboxesObj.i = CkImap::ckListSubscribed(imap,reference,mbxPattern)
    If CkImap::ckLastMethodSuccess(imap) = 0
        Debug CkImap::ckLastErrorText(imap)
        CkImap::ckDispose(imap)
        ProcedureReturn
    EndIf

    ;  ...
    ;  ...

    CkMailboxes::ckDispose(mboxesObj)

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

    ;  Lists only subscribed mailboxes.
    subscribed.i = 1

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

    success = CkImap::ckMbxList(imap,subscribed,reference,mbxPattern,mboxes)
    If success = 0
        Debug CkImap::ckLastErrorText(imap)
        CkImap::ckDispose(imap)
        CkMailboxes::ckDispose(mboxes)
        ProcedureReturn
    EndIf



    CkImap::ckDispose(imap)
    CkMailboxes::ckDispose(mboxes)


    ProcedureReturn
EndProcedure