KIMAP

setquotajob.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 "quotajobbase.h"
10
11namespace KIMAP
12{
13class Session;
14struct Response;
15class SetQuotaJobPrivate;
16
17/**
18 * Sets resource limits on a quota root.
19 *
20 * Quotas are defined with respect to "resources" and "quota roots".
21 * A resource is a numerical property that can be limited, such
22 * as the octet size of all the messages in a mailbox, or the
23 * number of messages in a mailbox. Each mailbox has one or more
24 * quota roots, which are where the resource limits are defined.
25 * A quota root may or may not be a mailbox name, and an empty
26 * string is a valid quota root. All mailboxes with the same quota
27 * root share the resource limits of the quota root.
28 *
29 * This job can only be run when the session is in the
30 * authenticated (or selected) state.
31 *
32 * This job requires that the server supports the QUOTA
33 * capability, defined in
34 * <a href="https://tools.ietf.org/html/rfc2087">RFC 2087</a>.
35 */
36class KIMAP_EXPORT SetQuotaJob : public QuotaJobBase
37{
38 Q_OBJECT
39 Q_DECLARE_PRIVATE(SetQuotaJob)
40
41 friend class SessionPrivate;
42
43public:
44 explicit SetQuotaJob(Session *session);
45 ~SetQuotaJob() override;
46
47 /**
48 * Set a limit for a quota resource.
49 *
50 * For example, you might set the limit for "STORAGE" to
51 * 512 to limit the sum of the messages' RFC822.SIZE to
52 * 512*1024 octets (ie: 512 kb), or the limit for "MESSAGE"
53 * to 100 to limit the number of messages to 100.
54 *
55 * Note that although RFC 2087 allows a resource name to
56 * be any string, this API actually limits resource names
57 * to upper-case atoms. In practice, resource names will
58 * almost certainly be composed entirely of upper-case latin
59 * letters (A-Z).
60 *
61 * @param resource the resource name
62 * @param limit the maximum value the resource may take
63 */
64 void setQuota(const QByteArray &resource, qint64 limit);
65
66 /**
67 * Set the quota root the resource limits should be set for.
68 *
69 * Note: if the quota root does not already exist, the server
70 * may create it and change the quota roots for any number of
71 * existing mailboxes in an implementation-defined manner.
72 *
73 * @param root the quota root to set, in bytes
74 * @see GetQuotaRootJob
75 */
76 void setRoot(const QByteArray &root);
77 /**
78 * The quota root that will be modified.
79 */
80 [[nodiscard]] QByteArray root() const;
81
82protected:
83 void doStart() override;
84 void handleResponse(const Response &response) override;
85};
86
87}
Base class for jobs that operate on mailbox quotas.
Sets resource limits on a quota root.
Definition setquotajob.h:37
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.