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

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 CloseJobPrivate;
0018 
0019 /**
0020  * Closes the current mailbox.
0021  *
0022  * This job can only be run when the session is in the selected state.
0023  *
0024  * Permanently removes all messages that have the \\Deleted
0025  * flag set from the currently selected mailbox, and returns
0026  * to the authenticated state from the selected state.
0027  *
0028  * The server will not provide any notifications of which
0029  * messages were expunged, so this is quicker than doing
0030  * an expunge and then implicitly closing the mailbox
0031  * (by selecting or examining another mailbox or logging
0032  * out). If the QRESYNC extension (RFC5162) is available on the
0033  * server and has been enabled, the job will provide a new
0034  * modification sequence after expunging the deleted messages.
0035  *
0036  * No messages are removed if the mailbox is open in a read-only
0037  * state, or if the server supports ACLs and the user does not
0038  * have the Acl::Expunge right on the mailbox.
0039  */
0040 class KIMAP_EXPORT CloseJob : public Job
0041 {
0042     Q_OBJECT
0043     Q_DECLARE_PRIVATE(CloseJob)
0044 
0045     friend class SessionPrivate;
0046 
0047 public:
0048     explicit CloseJob(Session *session);
0049     ~CloseJob() override = default;
0050 
0051     /**
0052      * Returns new modification sequence number after expunging messages.
0053      *
0054      * This value is only valid when server supports the QRESYNC extension
0055      * (RFC5162) and it has been explicitly enabled on this session.
0056      *
0057      * @see KIMAP::EnableJob
0058      * @since 5.16
0059      */
0060     [[nodiscard]] quint64 newHighestModSeq() const;
0061 
0062 protected:
0063     void doStart() override;
0064     void handleResponse(const Response &response) override;
0065 };
0066 
0067 }