INBOX folder special use.

This commit is contained in:
vincent-richard 2020-03-26 19:22:23 +01:00
parent 36cc0c65c8
commit 2d369b9ac9
5 changed files with 13 additions and 0 deletions

View File

@ -67,6 +67,7 @@ public:
enum SpecialUses {
SPECIALUSE_NONE, /**< User folder, no special use (or unknown). */
SPECIALUSE_ALL, /**< Virtual folder containing all messages. */
SPECIALUSE_INBOX, /**< Inbox. */
SPECIALUSE_ARCHIVE, /**< Folder is used to archives messages (server-dependent). */
SPECIALUSE_DRAFTS, /**< Folder is used to hold draft messages - typically, messages
that are being composed but have not yet been sent. */

View File

@ -244,6 +244,7 @@ void IMAPFolder::open(const int mode, bool failIfModeIsNotAvailable) {
IMAPUtils::mailboxFlagsToFolderAttributes(
connection,
m_path,
*responseData->mailbox_data->mailbox_flag_list,
*m_attribs
);
@ -527,6 +528,7 @@ int IMAPFolder::testExistAndGetType() {
// Get the folder type/flags at the same time
IMAPUtils::mailboxFlagsToFolderAttributes(
m_connection,
m_path,
*mailboxData->mailbox_list->mailbox_flag_list,
attribs
);
@ -755,6 +757,7 @@ std::vector <shared_ptr <folder> > IMAPFolder::getFolders(const bool recursive)
IMAPUtils::mailboxFlagsToFolderAttributes(
m_connection,
path,
*mailboxData->mailbox_list->mailbox_flag_list,
*attribs
);
@ -1523,6 +1526,7 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp) {
folderAttributes attribs;
IMAPUtils::mailboxFlagsToFolderAttributes(
m_connection,
m_path,
*(*it)->response_data->mailbox_data->mailbox_list->mailbox_flag_list,
attribs
);

View File

@ -390,6 +390,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) {
// static
void IMAPUtils::mailboxFlagsToFolderAttributes(
const shared_ptr <const IMAPConnection>& cnt,
const folder::path &path,
const IMAPParser::mailbox_flag_list& list,
folderAttributes& attribs
) {
@ -471,6 +472,10 @@ void IMAPUtils::mailboxFlagsToFolderAttributes(
}
}
if (path.getSize() == 1 && path.getLastComponent().getBuffer() == "INBOX") {
specialUse = folderAttributes::SPECIALUSE_INBOX;
}
attribs.setSpecialUse(specialUse);
attribs.setType(type);
attribs.setFlags(flags);

View File

@ -70,11 +70,13 @@ public:
/** Parse mailbox flags and fill in folder attributes.
*
* @param cnt reference to current IMAP connection (for testing capabilities)
* @param path folder full path
* @param list list of mailbox flags
* @param attribs reference to an object holding folder attributes
*/
static void mailboxFlagsToFolderAttributes(
const shared_ptr <const IMAPConnection>& cnt,
const folder::path &path,
const IMAPParser::mailbox_flag_list& list,
folderAttributes& attribs
);

View File

@ -103,6 +103,7 @@ const folderAttributes POP3Folder::getAttributes() {
attribs.setType(folderAttributes::TYPE_CONTAINS_FOLDERS);
} else if (m_path.getSize() == 1 && m_path[0].getBuffer() == "INBOX") {
attribs.setType(folderAttributes::TYPE_CONTAINS_MESSAGES);
attribs.setSpecialUse(folderAttributes::SPECIALUSE_INBOX);
} else {
throw exceptions::folder_not_found();
}