Sample code for 30+ languages & platforms
PureBasic

Transition from Imap.ListMailboxes to Imap.MbxList

Provides instructions for replacing deprecated ListMailboxes 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 ListMailboxes method is deprecated:

    ; Lists all mailboxes, including unsubscribed.
    mboxesObj.i = CkImap::ckListMailboxes(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 all mailboxes, including unsubscribed.
    subscribed.i = 0

    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