Sample code for 30+ languages & platforms
C++

Transition from Imap.ListSubscribed to Imap.MbxList

Provides instructions for replacing deprecated ListSubscribed method calls with MbxList.

Chilkat C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    CkImap imap;

    //  ...
    //  ...

    const char *reference = "";
    const char *mbxPattern = "*";

    //  ------------------------------------------------------------------------
    //  The ListSubscribed method is deprecated:

    //  Lists only subscribed mailboxes.
    CkMailboxes *mboxesObj = imap.ListSubscribed(reference,mbxPattern);
    if (imap.get_LastMethodSuccess() == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }

    //  ...
    //  ...

    delete 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.
    bool subscribed = true;

    CkMailboxes mboxes;
    success = imap.MbxList(subscribed,reference,mbxPattern,mboxes);
    if (success == false) {
        std::cout << imap.lastErrorText() << "\r\n";
        return;
    }
    }