KIMAP::FetchJob Class

Fetch message data from the server. More...

Header: #include <KIMAP/FetchJob>
CMake: find_package(KPim6IMAP REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::IMAP)
Inherits: KIMAP::Job

Public Types

class FetchScope

Public Functions

FetchJob(KIMAP::Session *session)
virtual ~FetchJob() override
bool isUidBased() const
QString mailBox() const
KIMAP::FetchJob::FetchScope scope() const
KIMAP::ImapSet sequenceSet() const
bool setGmailExtensionsEnabled() const
void setGmailExtensionsEnabled(bool enabled)
void setScope(const KIMAP::FetchJob::FetchScope &scope)
void setSequenceSet(const KIMAP::ImapSet &set)
void setUidBased(bool uidBased)

Signals

void messageExpunged(KIMAP::ImapSet::Id sequence)
void messagesAvailable(const QMap<qint64, KIMAP::Message> &messages)
void messagesVanished(const KIMAP::ImapSet &uids)

Detailed Description

All data is returned using the signals, so you need to connect to the relevant signal (or all of them) before starting the job.

This job will always use BODY.PEEK rather than BODY to fetch message content, so it will not set the Seen flag.

The \Recent flag will be excluded from the returned message flags. There is little value for clients to know about it, it can be error prone to store it, and it has been deprecated in IMAP4rev2.

This job can only be run when the session is in the selected state.

Member Function Documentation

[explicit] FetchJob::FetchJob(KIMAP::Session *session)

[override virtual noexcept] FetchJob::~FetchJob()

bool FetchJob::isUidBased() const

How to interpret the sequence set.

Returns true if the result of sequenceSet() should be interpreted as UIDs, false if it should be interpreted as sequence numbers

QString FetchJob::mailBox() const

Returns the name of the mailbox the fetch job is executed on.

Can only be accessed after the job is actually started, before that returns an empty string.

[signal] void FetchJob::messageExpunged(KIMAP::ImapSet::Id sequence)

Provides expunged message.

UID FETCH response may include `EXPUNGE` response code, indicating a message in the sequence has been permanently removed from the mailbox.

id Sequence number of the expunged message.

[signal] void FetchJob::messagesAvailable(const QMap<qint64, KIMAP::Message> &messages)

Provides received messages.

This signal is emitted when some data are received. The signal can be emitted multiple times as the messages are being received.

messages A map from message sequence number to message. Not all fields may be populated, depending on the fetch scope.

[signal] void FetchJob::messagesVanished(const KIMAP::ImapSet &uids)

Provides vanished messages.

This signal is emitted when QRESYNC capability (RFC5162) is available and has bee enabled on the server, and FetchScope::qresync has been set to true. It contains a list of messages that have vanished from the mailbox since the last modification sequence specified in FetchScope::changedSince.

uids UIDs of messages that have been removed from the mailbox since the specified modification sequence.

KIMAP::FetchJob::FetchScope FetchJob::scope() const

Specifies what data will be fetched.

See also setScope().

KIMAP::ImapSet FetchJob::sequenceSet() const

The messages that will be fetched.

See also setSequenceSet().

bool FetchJob::setGmailExtensionsEnabled() const

Returns whether Gmail support is enabled

See also setGmailExtensionsEnabled().

void FetchJob::setGmailExtensionsEnabled(bool enabled)

Enables retrieving of Gmail-specific extensions

The FETCH response will contain X-GM-MSGID, X-GM-THRID and X-GM-LABELS

Do NOT enable this, unless talking to Gmail servers, otherwise the request may fail.

enabled Whether the Gmail support should be enabled

void FetchJob::setScope(const KIMAP::FetchJob::FetchScope &scope)

Sets what data should be fetched.

The default scope is FetchScope::Content (all content parts).

scope a FetchScope object describing what data should be fetched

See also scope().

void FetchJob::setSequenceSet(const KIMAP::ImapSet &set)

Set which messages to fetch data for.

If sequence numbers are given, isUidBased() should be false. If UIDs are given, isUidBased() should be true.

set the sequence numbers or UIDs of the messages to fetch data for

See also sequenceSet().

void FetchJob::setUidBased(bool uidBased)

Set how the sequence set should be interpreted.

uidBased if true the argument to setSequenceSet will be interpreted as UIDs, if false it will be interpreted as sequence numbers

See also isUidBased().