From fa06cf1652c276ccfe0f050d6c7d145a6e5136e6 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 19 Oct 2010 13:28:43 +0000 Subject: [PATCH] Added support for DRAFT flag. --- AUTHORS | 1 + src/net/imap/IMAPMessage.cpp | 1 + src/net/imap/IMAPUtils.cpp | 5 ++++- src/net/maildir/maildirUtils.cpp | 2 ++ vmime/net/message.hpp | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index f0b5e2d5..6acebd0b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -20,6 +20,7 @@ VMIME CONTRIBUTORS - Pierre Thierry (patches for STL algorithms) - Zarafa - Bartek Szurgot + - Achim Brändt Please apologize if I have forgotten someone here. ;) See SVN Changelog for full list. diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp index bbdba69e..bc661edf 100644 --- a/src/net/imap/IMAPMessage.cpp +++ b/src/net/imap/IMAPMessage.cpp @@ -555,6 +555,7 @@ void IMAPMessage::setFlags(const int flags, const int mode) if (flags & FLAG_MARKED) flagList.push_back("\\Flagged"); if (flags & FLAG_DELETED) flagList.push_back("\\Deleted"); if (flags & FLAG_SEEN) flagList.push_back("\\Seen"); + if (flags & FLAG_DRAFT) flagList.push_back("\\Draft"); if (!flagList.empty()) { diff --git a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp index c4651edf..0d6fc478 100644 --- a/src/net/imap/IMAPUtils.cpp +++ b/src/net/imap/IMAPUtils.cpp @@ -419,10 +419,12 @@ int IMAPUtils::messageFlagsFromFlags(const IMAPParser::flag_list* list) case IMAPParser::flag::SEEN: flags |= message::FLAG_SEEN; break; + case IMAPParser::flag::DRAFT: + flags |= message::FLAG_DRAFT; + break; default: //case IMAPParser::flag::UNKNOWN: - //case IMAPParser::flag::DRAFT: break; } } @@ -439,6 +441,7 @@ const string IMAPUtils::messageFlagList(const int flags) if (flags & message::FLAG_MARKED) flagList.push_back("\\Flagged"); if (flags & message::FLAG_DELETED) flagList.push_back("\\Deleted"); if (flags & message::FLAG_SEEN) flagList.push_back("\\Seen"); + if (flags & message::FLAG_DRAFT) flagList.push_back("\\Draft"); if (!flagList.empty()) { diff --git a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp index 19887b24..3430d1f8 100644 --- a/src/net/maildir/maildirUtils.cpp +++ b/src/net/maildir/maildirUtils.cpp @@ -102,6 +102,7 @@ int maildirUtils::extractFlags(const utility::file::path::component& comp) case 'T': case 't': flags |= message::FLAG_DELETED; break; case 'F': case 'f': flags |= message::FLAG_MARKED; break; case 'P': case 'p': flags |= message::FLAG_PASSED; break; + case 'D': case 'd': flags |= message::FLAG_DRAFT; break; } } @@ -121,6 +122,7 @@ const utility::file::path::component maildirUtils::buildFlags(const int flags) if (flags & message::FLAG_REPLIED) str += "R"; if (flags & message::FLAG_SEEN) str += "S"; if (flags & message::FLAG_DELETED) str += "T"; + if (flags & message::FLAG_DRAFT) str += "D"; return (utility::file::path::component(str)); } diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp index b6ebef83..1fbd008d 100644 --- a/vmime/net/message.hpp +++ b/vmime/net/message.hpp @@ -227,6 +227,7 @@ public: FLAG_REPLIED = (1 << 3), /**< User replied to this message. */ FLAG_MARKED = (1 << 4), /**< Used-defined flag. */ FLAG_PASSED = (1 << 5), /**< Message has been resent/forwarded/bounced. */ + FLAG_DRAFT = (1 << 6), /**< Message is marked as a 'draft'. */ FLAG_UNDEFINED = 9999 /**< Used internally (this should not be returned by the flags() function). */