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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@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 CapabilitiesJobPrivate;
0018 
0019 /**
0020  * Checks server capabilities.
0021  *
0022  * This job can be run in any open session.
0023  *
0024  * This simply asks the server what capabilities it supports
0025  * (using the CAPABILITY command) and returns the list
0026  * provided by the server.  The list may, therefore, be
0027  * inaccurate: the server may claim to support something
0028  * it does not implement properly, or it may omit a feature
0029  * that it does, in reality, support.
0030  */
0031 class KIMAP_EXPORT CapabilitiesJob : public Job
0032 {
0033     Q_OBJECT
0034     Q_DECLARE_PRIVATE(CapabilitiesJob)
0035 
0036     friend class SessionPrivate;
0037 
0038 public:
0039     CapabilitiesJob(Session *session);
0040     ~CapabilitiesJob() override;
0041 
0042     /**
0043      * The capabilities the server claims to support.
0044      *
0045      * This will return an empty list until the job has completed.
0046      */
0047     [[nodiscard]] QStringList capabilities() const;
0048 
0049 Q_SIGNALS:
0050     /**
0051      * Notifies listeners that the capabilities have been fetched.
0052      *
0053      * @param capabilities  The capabilities the server claims to support.
0054      */
0055     void capabilitiesReceived(const QStringList &capabilities);
0056 
0057 protected:
0058     void doStart() override;
0059     void handleResponse(const Response &response) override;
0060 };
0061 
0062 }