Merge pull request #256 from jacadcaps/IMAP.PEEK

IMAP PEEK support.
This commit is contained in:
Vincent Richard 2021-03-31 21:37:30 +02:00 committed by GitHub
commit a6226e8cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -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. */
};

View File

@ -975,7 +975,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;
}

View File

@ -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 + ")]");
}
}
}