File indexing completed on 2024-05-12 05:17:21

0001 /*
0002     Copyright (c) 2009 Kevin Ottens <ervin@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 #ifndef KIMAP2_CAPABILITIESJOB_H
0021 #define KIMAP2_CAPABILITIESJOB_H
0022 
0023 #include "kimap2_export.h"
0024 
0025 #include "job.h"
0026 
0027 namespace KIMAP2
0028 {
0029 
0030 class Session;
0031 struct Message;
0032 class CapabilitiesJobPrivate;
0033 
0034 /**
0035  * Checks server capabilities.
0036  *
0037  * This job can be run in any open session.
0038  *
0039  * This simply asks the server what capabilities it supports
0040  * (using the CAPABILITY command) and returns the list
0041  * provided by the server.  The list may, therefore, be
0042  * inaccurate: the server may claim to support something
0043  * it does not implement properly, or it may omit a feature
0044  * that it does, in reality, support.
0045  */
0046 class KIMAP2_EXPORT CapabilitiesJob : public Job
0047 {
0048     Q_OBJECT
0049     Q_DECLARE_PRIVATE(CapabilitiesJob)
0050 
0051     friend class SessionPrivate;
0052 
0053 public:
0054     CapabilitiesJob(Session *session);
0055     virtual ~CapabilitiesJob();
0056 
0057     /**
0058      * The capabilities the server claims to support.
0059      *
0060      * This will return an empty list until the job has completed.
0061      */
0062     QStringList capabilities() const;
0063 
0064 Q_SIGNALS:
0065     /**
0066      * Notifies listeners that the capabilities have been fetched.
0067      *
0068      * @param capabilities  The capabilities the server claims to support.
0069      */
0070     void capabilitiesReceived(const QStringList &capabilities);
0071 
0072 protected:
0073     void doStart() Q_DECL_OVERRIDE;
0074     void handleResponse(const Message &response) Q_DECL_OVERRIDE;
0075 };
0076 
0077 }
0078 
0079 #endif