KIMAP2

getquotarootjob.h
1/*
2 Copyright (c) 2009 Andras Mantia <amantia@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef KIMAP2_GETQUOTAROOTJOB_H
21#define KIMAP2_GETQUOTAROOTJOB_H
22
23#include "quotajobbase.h"
24
25namespace KIMAP2
26{
27
28class Session;
29struct Message;
30class GetQuotaRootJobPrivate;
31
32/**
33 * Gets the quota root and resource limits for a mailbox.
34 *
35 * Quotas are defined with respect to "resources" and "quota roots".
36 * A resource is a numerical property that can be limited, such
37 * as the octet size of all the messages in a mailbox, or the
38 * number of messages in a mailbox. Each mailbox has one or more
39 * quota roots, which are where the resource limits are defined.
40 * A quota root may or may not be a mailbox name, and an empty
41 * string is a valid quota root. All mailboxes with the same quota
42 * root share the resource limits of the quota root.
43 *
44 * This job can only be run when the session is in the
45 * authenticated (or selected) state.
46 *
47 * This job requires that the server supports the QUOTA
48 * capability, defined in
49 * <a href="http://www.apps.ietf.org/rfc/rfc2087.html">RFC 2087</a>.
50 */
51class KIMAP2_EXPORT GetQuotaRootJob : public QuotaJobBase
52{
53 Q_OBJECT
54 Q_DECLARE_PRIVATE(GetQuotaRootJob)
55
56 friend class SessionPrivate;
57
58public:
59 explicit GetQuotaRootJob(Session *session);
60 virtual ~GetQuotaRootJob();
61
62 /**
63 * Set the mailbox to get the quota roots for.
64 *
65 * @param mailBox the name of an existing mailbox
66 */
67 void setMailBox(const QString &mailBox);
68 /**
69 * The mailbox that the quota roots will be fetched for.
70 */
71 QString mailBox() const;
72
73 /**
74 * The quota roots for the mailbox.
75 */
76 QList<QByteArray> roots() const;
77 /**
78 * Get the current usage for a resource.
79 *
80 * Note that if there is no limit for a resource, the
81 * server will not provide information about resource
82 * usage.
83 *
84 * @param root the quota root to get the resource usage for
85 * @param resource the resource to get the usage for
86 * @return the resource usage in appropriate units, or -1
87 * if the usage is unknown or there is no
88 * limit on the resource
89 */
90 qint64 usage(const QByteArray &root, const QByteArray &resource) const;
91 /**
92 * Get the current limit for a resource.
93 *
94 * @param root the quota root to get the resource limit for
95 * @param resource the resource to get the limit for
96 * @return the resource limit in appropriate units, or -1
97 * if the limit is unknown or there is no
98 * limit on the resource
99 */
100 qint64 limit(const QByteArray &root, const QByteArray &resource) const;
101
102 /**
103 * Get a map containing all resource usage figures for a quota root.
104 *
105 * @param root the quota root to get resource usage figures for
106 * @return a map from resource names to usage figures
107 */
108 QMap<QByteArray, qint64> allUsages(const QByteArray &root) const;
109 /**
110 * Get a map containing all resource limits for a quota root.
111 *
112 * @param root the quota root to get resource limits for
113 * @return a map from resource names to limits
114 */
115 QMap<QByteArray, qint64> allLimits(const QByteArray &root) const;
116
117protected:
118 void doStart() Q_DECL_OVERRIDE;
119 void handleResponse(const Message &response) Q_DECL_OVERRIDE;
120
121};
122
123}
124
125#endif
Gets the quota root and resource limits for a mailbox.
Base class for jobs that operate on mailbox quotas.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:09:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.