KIMAP

selectjob.h
1/*
2 SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "kimap_export.h"
10
11#include "fetchjob.h"
12#include "job.h"
13
14namespace KIMAP
15{
16class Session;
17struct Response;
18class SelectJobPrivate;
19class ImapSet;
20
21class KIMAP_EXPORT SelectJob : public Job
22{
23 Q_OBJECT
24 Q_DECLARE_PRIVATE(SelectJob)
25
26 friend class SessionPrivate;
27
28public:
29 explicit SelectJob(Session *session);
30 ~SelectJob() override;
31
32 void setMailBox(const QString &mailBox);
33 [[nodiscard]] QString mailBox() const;
34
35 void setOpenReadOnly(bool readOnly);
36 /**
37 * @return Returns whether the mailbox is opened in read-only mode. Note
38 * that this can return true even if setOpenReadOnly() was set to false,
39 * as the mailbox may be read-only on the server.
40 */
41 [[nodiscard]] bool isOpenReadOnly() const;
42
43 [[nodiscard]] QList<QByteArray> flags() const;
44 [[nodiscard]] QList<QByteArray> permanentFlags() const;
45
46 [[nodiscard]] int messageCount() const;
47 [[nodiscard]] int recentCount() const;
48 [[nodiscard]] int firstUnseenIndex() const;
49
50 [[nodiscard]] qint64 uidValidity() const;
51 [[nodiscard]] qint64 nextUid() const;
52
53 /**
54 * @return Highest mod-sequence value of all messages in the mailbox or 0
55 * if the server does not have CONDSTORE capability (RFC4551) or does not
56 * support persistent storage of mod-sequences.
57 *
58 * @since 4.12
59 */
60 [[nodiscard]] quint64 highestModSequence() const;
61
62 /**
63 * Whether to append CONDSTORE parameter to the SELECT command.
64 *
65 * This option is false by default and can be enabled only when server
66 * has CONDSTORE capability (RFC4551), otherwise the SELECT command will
67 * fail.
68 *
69 * @since 4.12
70 */
71 void setCondstoreEnabled(bool enable);
72
73 /**
74 * Returns whether the CONDSTORE parameter will be appended to SELECT command
75 *
76 * @since 4.12
77 */
78 [[nodiscard]] bool condstoreEnabled() const;
79
80 /**
81 * Set Quick Resynchronization parameters.
82 *
83 * Requires that the server supports the QRESYNC extension as defined in RFC5162
84 * and the QRESYNC extension has been enabled via EnableJob.
85 *
86 * Using this option implies enabling CONDSTORE.
87 *
88 * @param lastUidvalidity Last UIDValidity value known to the client
89 * @param lastModseq Last modification sequence number known to the client
90 * @param knownUids List of all UIDs known to the client (optional).
91 *
92 * @see KIMAP::EnableJob
93 */
94 void setQResync(qint64 lastUidvalidity, quint64 lastModseq, const ImapSet &knownUids = ImapSet{});
95
96Q_SIGNALS:
97 /**
98 * Emitted when the server provides a list of UIDs that have vanished since last sync.
99 *
100 * This feature requires that the QRESYNC parameters have been provided
101 * to the SELECT command. This signal may not be emitted if no messages
102 * have been expunged since the last check.
103 *
104 * @see setQResync()
105 * @since 5.16
106 */
107 void vanished(const KIMAP::ImapSet &set);
108
109 /**
110 * Emitted when the server provides a list of messages that have changed or appeared
111 * in the mailbox since the last sync.
112 *
113 * This feature requires that the QRESYNC parameters have been provided
114 * to the SELECT command. The signal may not be emitted if no messages
115 * have been modified or appended to the mailbox.
116 *
117 * @see setQResync()
118 * @since 5.16
119 */
120 void modified(const QMap<qint64, KIMAP::Message> &messages);
121
122protected:
123 void doStart() override;
124 void handleResponse(const Response &response) override;
125};
126
127}
Represents a set of natural numbers (1->∞) in a as compact as possible form.
Definition imapset.h:127
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:06:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.