diff --git a/src/vmime/net/folderAttributes.hpp b/src/vmime/net/folderAttributes.hpp index b91347b5..715b72a8 100644 --- a/src/vmime/net/folderAttributes.hpp +++ b/src/vmime/net/folderAttributes.hpp @@ -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. */ diff --git a/src/vmime/net/imap/IMAPFolder.cpp b/src/vmime/net/imap/IMAPFolder.cpp index e3bc958f..751c84dc 100644 --- a/src/vmime/net/imap/IMAPFolder.cpp +++ b/src/vmime/net/imap/IMAPFolder.cpp @@ -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 > 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 ); diff --git a/src/vmime/net/imap/IMAPUtils.cpp b/src/vmime/net/imap/IMAPUtils.cpp index 273531fd..59b1e181 100644 --- a/src/vmime/net/imap/IMAPUtils.cpp +++ b/src/vmime/net/imap/IMAPUtils.cpp @@ -390,6 +390,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) { // static void IMAPUtils::mailboxFlagsToFolderAttributes( const shared_ptr & 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); diff --git a/src/vmime/net/imap/IMAPUtils.hpp b/src/vmime/net/imap/IMAPUtils.hpp index 123bc8c7..d4bd1356 100644 --- a/src/vmime/net/imap/IMAPUtils.hpp +++ b/src/vmime/net/imap/IMAPUtils.hpp @@ -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 & cnt, + const folder::path &path, const IMAPParser::mailbox_flag_list& list, folderAttributes& attribs ); diff --git a/src/vmime/net/pop3/POP3Folder.cpp b/src/vmime/net/pop3/POP3Folder.cpp index 4ca494fe..b69a483d 100644 --- a/src/vmime/net/pop3/POP3Folder.cpp +++ b/src/vmime/net/pop3/POP3Folder.cpp @@ -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(); }