KIMAP

metadatajobbase.h
1/*
2 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@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 "job.h"
12
13namespace KIMAP
14{
15class Session;
16struct Response;
17class MetaDataJobBasePrivate;
18
19/**
20 * Base class for jobs that operate on mailbox metadata
21 *
22 * Provides support for the IMAP METADATA extension; both the
23 * final RFC version
24 * (<a href="https://tools.ietf.org/html/rfc5464">RFC 5464</a>)
25 * and the older, incompatible draft version (known as ANNOTATEMORE)
26 * (<a
27 * href="https://tools.ietf.org/html/draft-daboo-imap-annotatemore-07"
28 * >draft-daboo-imap-annotatemore-07</a>).
29 *
30 * This class cannot be used directly, you must subclass it and reimplement
31 * at least the doStart() method.
32 */
33class KIMAP_EXPORT MetaDataJobBase : public Job
34{
35 Q_OBJECT
36 Q_DECLARE_PRIVATE(MetaDataJobBase)
37
38 friend class SessionPrivate;
39
40public:
41 explicit MetaDataJobBase(Session *session);
42 ~MetaDataJobBase() override;
43
44 /**
45 * Represents the capability level of the server.
46 */
48 /**
49 * Used to indicate that the server supports the RFC 5464 version
50 * of the extension.
51 *
52 * This corresponds to the METADATA server capability.
53 */
54 Metadata = 0,
55 /**
56 * Used to indicate that the server supports the
57 * draft-daboo-imap-annotatemore-07 version of the extension.
58 *
59 * This corresponds to the ANNOTATEMORE server capability.
60 */
61 Annotatemore
62 };
63
64 /**
65 * Set the mailbox to act on
66 *
67 * This may be an empty string, in which case metadata for the
68 * server (rather than a specific mailbox) will be retrieved.
69 *
70 * @param mailBox the name of an existing mailbox, or an empty string
71 */
72 void setMailBox(const QString &mailBox);
73 /**
74 * The mailbox that will be acted upon.
75 *
76 * If this is an empty string, server metadata will be retrieved.
77 *
78 * @return a mailbox name, or an empty string
79 */
80 [[nodiscard]] QString mailBox() const;
81
82 /**
83 * Set what version of the metadata extension to be compatible with.
84 *
85 * This will determine the commands that will be sent to the server.
86 *
87 * The draft for the metadata extension changed in an incompatible
88 * way between versions 7 and 8, and some servers support version 7.
89 * It should be possible to check which version the server supports
90 * using CapabilityJob: servers implementing
91 * draft-daboo-imap-annotatemore-07 should advertise the
92 * ANNOTATEMORE capability, whereas servers implementing the final
93 * RFC 5464 should advertise the METADATA capability.
94 *
95 * The default mode is Metadata.
96 *
97 * @param capability the version of the extension implemented by the server
98 */
99 void setServerCapability(ServerCapability capability);
100 /**
101 * The version of the metadata extension that will be used.
102 */
103 [[nodiscard]] ServerCapability serverCapability() const;
104
105protected:
106 MetaDataJobBase(JobPrivate &dd);
107};
108
109}
Base class for jobs that operate on mailbox metadata.
ServerCapability
Represents the capability level of the server.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.