File indexing completed on 2024-05-12 05:17:15
0001 /* 0002 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kimap_export.h" 0010 0011 #include "job.h" 0012 0013 namespace KIMAP 0014 { 0015 class Session; 0016 struct Response; 0017 class QuotaJobBasePrivate; 0018 0019 /** 0020 * Base class for jobs that operate on mailbox quotas 0021 * 0022 * Provides support for the IMAP QUOTA extension, as defined by 0023 * <a href="https://tools.ietf.org/html/rfc2087" title="IMAP QUOTA extension">RFC 2087</a>. 0024 * 0025 * This class cannot be used directly, you must subclass it and reimplement 0026 * at least the doStart() method. 0027 */ 0028 class KIMAP_EXPORT QuotaJobBase : public Job 0029 { 0030 Q_OBJECT 0031 Q_DECLARE_PRIVATE(QuotaJobBase) 0032 0033 friend class SessionPrivate; 0034 0035 public: 0036 explicit QuotaJobBase(Session *session); 0037 ~QuotaJobBase() override; 0038 0039 /** 0040 * Get the current usage for a resource. 0041 * 0042 * All quota jobs will normally cause the server to return 0043 * details of resource usage for all resources that were 0044 * queried or modified by the job. 0045 * 0046 * Note that RFC 2087 is slightly ambiguous about whether 0047 * SETQUOTA will cause this information to be sent by the 0048 * server. 0049 * 0050 * Note that if there is no limit for a resource, the 0051 * server will not provide information about resource 0052 * usage. 0053 * 0054 * @param resource the resource to get the usage for 0055 * @return the resource usage in appropriate units, or -1 0056 * if the usage is unknown or there is no 0057 * limit on the resource 0058 */ 0059 [[nodiscard]] qint64 usage(const QByteArray &resource); 0060 /** 0061 * Get the current limit for a resource. 0062 * 0063 * All quota jobs will normally cause the server to return 0064 * details of resource limits for all resources that were 0065 * queried or modified by the job. 0066 * 0067 * Note that RFC 2087 is slightly ambiguous about whether 0068 * SETQUOTA will cause this information to be sent by the 0069 * server. 0070 * 0071 * @param resource the resource to get the limit for 0072 * @return the resource limit in appropriate units, or -1 0073 * if the limit is unknown or there is no limit 0074 * on the resource 0075 */ 0076 [[nodiscard]] qint64 limit(const QByteArray &resource); 0077 0078 protected: 0079 QuotaJobBase(JobPrivate &dd); 0080 }; 0081 0082 }