mail::ACCOUNT::getTopLevelFolders.3x man page


mail::ACCOUNT::getTopLevelFolders — Enumerate top-level folders


#include <libmail/sync.H>

mail::ACCOUNT *mail;
mail::ACCOUNT::FolderList folderList;

bool ok=mail->getTopLevelFolders(folderList);

std::string errmsg=mail->getErrmsg();
size_t nFolders=folderList::size();
const mail::folder *folder=folderList[n];


A mail account contains a collection of folders, arranged in a top-to-bottom hierarchy. This function returns the list of the folders at the top-level of the folder hierarchy.

mail::ACCOUNT::getTopLevelFolders, if succesful, initializes a list of mail::folder objects, which are maintained by the mail::ACCOUNT::FolderList class. Each mail::folder object represents a mail account's folder. The number of folders, and a pointer to each folder object, is obtained according to the example above.


Pointers to mail::folder objects are no longer valid after the mail::ACCOUNT::FolderList object is destroyed. The application should use mail::folder::clone(3x) to create a duplicate copy of the mail::folder object (which the application is now responsible for destroying).

Return Codes and Callbacks

This method returns true if it succeeds, or false if it fails. If the method fails, use mail::ACCOUNT::getErrmsg() to read a brief description of the error.

See Also

mail::ACCOUNT::login(3x), mail::ACCOUNT::getSubFolders(3x).


Sam Varshavchik


Cone© Cone: COnsole Newsreader And E 08/25/2013