IMAP PEEK support

This commit is contained in:
Jacek Piszczek 2021-03-24 12:27:47 -04:00
parent 47c6f35f5a
commit a0d02afc69
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

@ -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;
}

View File

@ -691,9 +691,13 @@ shared_ptr <IMAPCommand> IMAPUtils::buildFetchCommand(
list += *it;
}
if (options.has(fetchAttributes::PEEK)) {
items.push_back("BODY.PEEK[HEADER.FIELDS (" + list + ")]");
} else {
items.push_back("BODY[HEADER.FIELDS (" + list + ")]");
}
}
}
return IMAPCommand::FETCH(msgs, items);
}