diff --git a/ChangeLog b/ChangeLog index 4f1c452b..4178ee0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ VERSION 0.7.2cvs ================ +2005-07-25 Vincent Richard + + * Messaging folder: added a FETCH_IMPORTANCE flag to fetch the fields used + with 'misc::importanceHelper'. + 2005-07-23 Vincent Richard * POP3, IMAP, maildir: fixed getMessages() when default arguments are given: diff --git a/src/messaging/imap/IMAPFolder.cpp b/src/messaging/imap/IMAPFolder.cpp index a63e8aa6..ca09fa47 100644 --- a/src/messaging/imap/IMAPFolder.cpp +++ b/src/messaging/imap/IMAPFolder.cpp @@ -643,7 +643,8 @@ void IMAPFolder::fetchMessage(ref msg, const int options) const int IMAPFolder::getFetchCapabilities() const { return (FETCH_ENVELOPE | FETCH_CONTENT_INFO | FETCH_STRUCTURE | - FETCH_FLAGS | FETCH_SIZE | FETCH_FULL_HEADER | FETCH_UID); + FETCH_FLAGS | FETCH_SIZE | FETCH_FULL_HEADER | FETCH_UID | + FETCH_IMPORTANCE); } diff --git a/src/messaging/imap/IMAPMessage.cpp b/src/messaging/imap/IMAPMessage.cpp index bbda8386..ba77251b 100644 --- a/src/messaging/imap/IMAPMessage.cpp +++ b/src/messaging/imap/IMAPMessage.cpp @@ -492,8 +492,32 @@ void IMAPMessage::fetch(IMAPFolder* folder, const int options) if (options & folder::FETCH_ENVELOPE) items.push_back("ENVELOPE"); + std::vector headerFields; + if (options & folder::FETCH_CONTENT_INFO) - items.push_back("BODY[HEADER.FIELDS (CONTENT-TYPE)]"); + headerFields.push_back("CONTENT_TYPE"); + + if (options & folder::FETCH_IMPORTANCE) + { + headerFields.push_back("IMPORTANCE"); + headerFields.push_back("X-PRIORITY"); + } + + if (!headerFields.empty()) + { + string list; + + for (std::vector ::iterator it = headerFields.begin() ; + it != headerFields.end() ; ++it) + { + if (it != headerFields.begin()) + list += " "; + + list += *it; + } + + items.push_back("BODY[HEADER.FIELDS (" + list + ")]"); + } } // Build the request text diff --git a/src/messaging/maildir/maildirFolder.cpp b/src/messaging/maildir/maildirFolder.cpp index ebb0dd29..e7a4e2f8 100644 --- a/src/messaging/maildir/maildirFolder.cpp +++ b/src/messaging/maildir/maildirFolder.cpp @@ -1368,7 +1368,8 @@ void maildirFolder::fetchMessage(ref msg, const int options) const int maildirFolder::getFetchCapabilities() const { return (FETCH_ENVELOPE | FETCH_STRUCTURE | FETCH_CONTENT_INFO | - FETCH_FLAGS | FETCH_SIZE | FETCH_FULL_HEADER | FETCH_UID); + FETCH_FLAGS | FETCH_SIZE | FETCH_FULL_HEADER | FETCH_UID | + FETCH_IMPORTANCE); } diff --git a/src/messaging/maildir/maildirMessage.cpp b/src/messaging/maildir/maildirMessage.cpp index daaa2784..e2393774 100644 --- a/src/messaging/maildir/maildirMessage.cpp +++ b/src/messaging/maildir/maildirMessage.cpp @@ -421,7 +421,8 @@ void maildirMessage::fetch(weak_ref folder, const int options) m_uid = maildirUtils::extractId(path.getLastComponent()).getBuffer(); if (options & (folder::FETCH_ENVELOPE | folder::FETCH_CONTENT_INFO | - folder::FETCH_FULL_HEADER | folder::FETCH_STRUCTURE)) + folder::FETCH_FULL_HEADER | folder::FETCH_STRUCTURE | + folder::FETCH_IMPORTANCE)) { string contents; @@ -481,7 +482,8 @@ void maildirMessage::fetch(weak_ref folder, const int options) // Extract some header fields or whole header if (options & (folder::FETCH_ENVELOPE | folder::FETCH_CONTENT_INFO | - folder::FETCH_FULL_HEADER)) + folder::FETCH_FULL_HEADER | + folder::FETCH_IMPORTANCE)) { getOrCreateHeader()->copyFrom(*(msg.getHeader())); } diff --git a/src/messaging/pop3/POP3Folder.cpp b/src/messaging/pop3/POP3Folder.cpp index 0afd3589..ec2c9d52 100644 --- a/src/messaging/pop3/POP3Folder.cpp +++ b/src/messaging/pop3/POP3Folder.cpp @@ -476,7 +476,8 @@ void POP3Folder::fetchMessage(ref msg, const int options) const int POP3Folder::getFetchCapabilities() const { return (FETCH_ENVELOPE | FETCH_CONTENT_INFO | - FETCH_SIZE | FETCH_FULL_HEADER | FETCH_UID); + FETCH_SIZE | FETCH_FULL_HEADER | FETCH_UID | + FETCH_IMPORTANCE); } diff --git a/src/messaging/pop3/POP3Message.cpp b/src/messaging/pop3/POP3Message.cpp index 7b848f87..ed8999e3 100644 --- a/src/messaging/pop3/POP3Message.cpp +++ b/src/messaging/pop3/POP3Message.cpp @@ -170,12 +170,12 @@ void POP3Message::fetch(POP3Folder* folder, const int options) throw exceptions::operation_not_supported(); // Check for the real need to fetch the full header - if (!((options & folder::FETCH_ENVELOPE) || - (options & folder::FETCH_CONTENT_INFO) || - (options & folder::FETCH_FULL_HEADER))) - { + static const int optionsRequiringHeader = + folder::FETCH_ENVELOPE | folder::FETCH_CONTENT_INFO | + folder::FETCH_FULL_HEADER | folder::FETCH_IMPORTANCE; + + if (!(options & optionsRequiringHeader)) return; - } // No need to differenciate between FETCH_ENVELOPE, // FETCH_CONTENT_INFO, ... since POP3 only permits to diff --git a/vmime/messaging/folder.hpp b/vmime/messaging/folder.hpp index 246a0e06..ac6e4250 100644 --- a/vmime/messaging/folder.hpp +++ b/vmime/messaging/folder.hpp @@ -321,6 +321,7 @@ public: FETCH_SIZE = (1 << 4), /**< Fetch message size (exact or estimated). */ FETCH_FULL_HEADER = (1 << 5), /**< Fetch full RFC-[2]822 header. */ FETCH_UID = (1 << 6), /**< Fetch unique identifier (protocol specific). */ + FETCH_IMPORTANCE = (1 << 7), /**< Fetch header fields suitable for use with misc::importanceHelper. */ FETCH_CUSTOM = (1 << 16) /**< Reserved for future use. */ };