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 KIMAP_QUOTAJOBBASE_H
21#define KIMAP_QUOTAJOBBASE_H
22
23#include "kimap_export.h"
24
25#include "job.h"
26
27namespace KIMAP {
28
29class Session;
30struct Message;
31class QuotaJobBasePrivate;
32
33/**
34 * Base class for jobs that operate on mailbox quotas
35 *
36 * Provides support for the IMAP QUOTA extension, as defined by
37 * <a href="http://www.apps.ietf.org/rfc/rfc2087.html" title="IMAP QUOTA extension">RFC 2087</a>.
38 *
39 * This class cannot be used directly, you must subclass it and reimplement
40 * at least the doStart() method.
41*/
42class KIMAP_EXPORT QuotaJobBase : public Job
43{
44 Q_OBJECT
45 Q_DECLARE_PRIVATE( QuotaJobBase )
46
47 friend class SessionPrivate;
48
49 public:
50 explicit QuotaJobBase( Session *session );
51 virtual ~QuotaJobBase();
52
53 /**
54 * Get the current usage for a resource.
55 *
56 * All quota jobs will normally cause the server to return
57 * details of resource usage for all resources that were
58 * queried or modified by the job.
59 *
60 * Note that RFC 2087 is slightly ambiguous about whether
61 * SETQUOTA will cause this information to be sent by the
62 * server.
63 *
64 * Note that if there is no limit for a resource, the
65 * server will not provide information about resource
66 * usage.
67 *
68 * @param resource the resource to get the usage for
69 * @return the resource usage in appropriate units, or -1
70 * if the usage is unknown or there is no
71 * limit on the resource
72 */
73 qint64 usage(const QByteArray& resource);
74 /**
75 * Get the current limit for a resource.
76 *
77 * All quota jobs will normally cause the server to return
78 * details of resource limits for all resources that were
79 * queried or modified by the job.
80 *
81 * Note that RFC 2087 is slightly ambiguous about whether
82 * SETQUOTA will cause this information to be sent by the
83 * server.
84 *
85 * @param resource the resource to get the limit for
86 * @return the resource limit in appropriate units, or -1
87 * if the limit is unknown or there is no limit
88 * on the resource
89 */
90 qint64 limit(const QByteArray& resource);
91
92 protected:
93 QuotaJobBase( JobPrivate &dd );
94
95};
96
97}
98
99#endif
100