File indexing completed on 2024-05-12 05:17:22
0001 /* 0002 Copyright (c) 2009 Andras Mantia <amantia@kde.org> 0003 0004 This library is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to the 0016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0017 02110-1301, USA. 0018 */ 0019 0020 #include "getquotajob.h" 0021 0022 #include "quotajobbase_p.h" 0023 #include "message_p.h" 0024 #include "session_p.h" 0025 0026 namespace KIMAP2 0027 { 0028 class GetQuotaJobPrivate : public QuotaJobBasePrivate 0029 { 0030 public: 0031 GetQuotaJobPrivate(Session *session, const QString &name) : QuotaJobBasePrivate(session, name) { } 0032 ~GetQuotaJobPrivate() { } 0033 0034 QByteArray root; 0035 }; 0036 } 0037 0038 using namespace KIMAP2; 0039 0040 GetQuotaJob::GetQuotaJob(Session *session) 0041 : QuotaJobBase(*new GetQuotaJobPrivate(session, "GetQuota")) 0042 { 0043 } 0044 0045 GetQuotaJob::~GetQuotaJob() 0046 { 0047 } 0048 0049 void GetQuotaJob::doStart() 0050 { 0051 Q_D(GetQuotaJob); 0052 //XXX: [alexmerry, 2010-07-24]: should d->root be quoted properly? 0053 d->sendCommand("GETQUOTA", '\"' + d->root + '\"'); 0054 } 0055 0056 void GetQuotaJob::handleResponse(const Message &response) 0057 { 0058 Q_D(GetQuotaJob); 0059 if (handleErrorReplies(response) == NotHandled) { 0060 if (response.content.size() >= 4 && 0061 response.content[1].toString() == "QUOTA") { 0062 d->quota = d->readQuota(response.content[3]); 0063 } 0064 } 0065 } 0066 0067 void GetQuotaJob::setRoot(const QByteArray &root) 0068 { 0069 Q_D(GetQuotaJob); 0070 d->root = root; 0071 } 0072 0073 QByteArray GetQuotaJob::root() const 0074 { 0075 Q_D(const GetQuotaJob); 0076 return d->root; 0077 }