Name

mail::folder::readFolderInfo — Get folder status

Synopsis




#include <libmail/mail.H>


class myCallback : public mail::callback {
public:
    void success(std::string msg);
    void fail(std::string msg);
};


mail::folder *folder;

class myFolderInfoCallback : public mail::callback::folderInfo {

public:
        void success()
        {
            displayFolderStatus(messageCount, unreadCount);
        }
};

folder->readFolderInfo( myFolderInfoCallback &folderInfoCallback,
  myCallback &callback);
 

USAGE

This function reads the current status of folder, which may refer to any folder in the mail account (not necessarily the currently open folder).

folderInfoCallback's success method will be invoked when the folder's status is determined. The following variables will be initialized prior to invoking success:

messageCount

Total number of messages in the folder.

unreadCount

Total number of unread messages in the folder.

fastInfo

This field should be initialized before calling this function. If set to true the message counts are returned only if they can be computed quickly. Otherwise folderInfoCallback's success method will not be invoked at all, but callback's success method will still be invoked.

If this field is set to false (the default), the message counts are returned in all cases.

Note

folderInfoCallback's success method will be invoked just prior to callback's success method (unless fastInfo is true and message counts cannot be computed cheaply). The application must still wait until callback's success, or fail is invoked, and must not destroy the mail::callback::folderInfo object until either method has been invoked.

Note

Message count computation is considered cheap with maildir-based and POP3-based accounts. Message count computation is considered expensive with mbox-based accounts, and with IMAP-based accounts.

RETURN CODES AND CALLBACKS

The application must wait until callback's success or fail method is invoked. The success method is invoked when this request is succesfully processed. The fail method is invoked if this request cannot be processed. The application must not destroy callback until either the success or fail method is invoked.

Note

callback's fail method may be invoked even after other callback methods were invoked. This indicates that the request was partially completed before the error was encountered.