aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacek Piszczek <[email protected]>2021-03-24 16:27:47 +0000
committerJacek Piszczek <[email protected]>2021-03-24 16:27:47 +0000
commita0d02afc6961a6ac7631666abf497d2d67a4ecb1 (patch)
tree9199ac6626d312cd1799c4320f8e55266d0cf390 /src
parent#250 Fixed unquoted mailbox name (diff)
downloadvmime-a0d02afc6961a6ac7631666abf497d2d67a4ecb1.tar.gz
vmime-a0d02afc6961a6ac7631666abf497d2d67a4ecb1.zip
IMAP PEEK support
Diffstat (limited to 'src')
-rw-r--r--src/vmime/net/fetchAttributes.hpp1
-rw-r--r--src/vmime/net/imap/IMAPFolder.cpp3
-rw-r--r--src/vmime/net/imap/IMAPUtils.cpp6
3 files changed, 8 insertions, 2 deletions
diff --git a/src/vmime/net/fetchAttributes.hpp b/src/vmime/net/fetchAttributes.hpp
index 19d92627..1a32116b 100644
--- a/src/vmime/net/fetchAttributes.hpp
+++ b/src/vmime/net/fetchAttributes.hpp
@@ -57,6 +57,7 @@ public:
FULL_HEADER = (1 << 5), /**< Full RFC-[2]822 header. */
UID = (1 << 6), /**< Unique identifier (protocol specific). */
IMPORTANCE = (1 << 7), /**< Header fields suitable for use with misc::importanceHelper. */
+ PEEK = (1 << 8), /**< Use IMAP PEEK method when accessing HEADER fields. */
CUSTOM = (1 << 16) /**< Reserved for future use. */
};
diff --git a/src/vmime/net/imap/IMAPFolder.cpp b/src/vmime/net/imap/IMAPFolder.cpp
index 98bc05d8..3a33469a 100644
--- a/src/vmime/net/imap/IMAPFolder.cpp
+++ b/src/vmime/net/imap/IMAPFolder.cpp
@@ -964,7 +964,8 @@ int IMAPFolder::getFetchCapabilities() const {
return fetchAttributes::ENVELOPE | fetchAttributes::CONTENT_INFO |
fetchAttributes::STRUCTURE | fetchAttributes::FLAGS |
fetchAttributes::SIZE | fetchAttributes::FULL_HEADER |
- fetchAttributes::UID | fetchAttributes::IMPORTANCE;
+ fetchAttributes::UID | fetchAttributes::IMPORTANCE |
+ fetchAttributes::PEEK;
}
diff --git a/src/vmime/net/imap/IMAPUtils.cpp b/src/vmime/net/imap/IMAPUtils.cpp
index 59b1e181..8c055356 100644
--- a/src/vmime/net/imap/IMAPUtils.cpp
+++ b/src/vmime/net/imap/IMAPUtils.cpp
@@ -691,7 +691,11 @@ shared_ptr <IMAPCommand> IMAPUtils::buildFetchCommand(
list += *it;
}
- items.push_back("BODY[HEADER.FIELDS (" + list + ")]");
+ if (options.has(fetchAttributes::PEEK)) {
+ items.push_back("BODY.PEEK[HEADER.FIELDS (" + list + ")]");
+ } else {
+ items.push_back("BODY[HEADER.FIELDS (" + list + ")]");
+ }
}
}