File indexing completed on 2025-01-26 04:45:36

0001 /*
0002   SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadi-mime_export.h"
0010 #include "filteractionjob_p.h"
0011 #include "transportattribute.h"
0012 
0013 #include <Akonadi/ItemFetchScope>
0014 #include <Akonadi/Job>
0015 
0016 namespace Akonadi
0017 {
0018 /**
0019   FilterAction that finds all messages with a DispatchMode of Manual
0020   and assigns them a DispatchMode of Immediately.
0021 
0022   This is used to send "queued" messages on demand.
0023 
0024   @see FilterActionJob
0025 
0026   @author Constantin Berzan <exit3219@gmail.com>
0027   @since 4.4
0028 */
0029 class SendQueuedAction : public Akonadi::FilterAction
0030 {
0031 public:
0032     /** Creates a SendQueuedAction. */
0033     SendQueuedAction();
0034 
0035     /** Destroys this object. */
0036     ~SendQueuedAction() override;
0037 
0038     Akonadi::ItemFetchScope fetchScope() const override;
0039 
0040     bool itemAccepted(const Akonadi::Item &item) const override;
0041 
0042     Akonadi::Job *itemAction(const Akonadi::Item &item, Akonadi::FilterActionJob *parent) const override;
0043 };
0044 
0045 /**
0046   FilterAction that finds all messages with an ErrorAttribute,
0047   removes the attribute, and sets the "$QUEUED" flag.
0048 
0049   This is used to retry sending messages that failed.
0050 
0051   @see FilterActionJob
0052 
0053   @author Constantin Berzan <exit3219@gmail.com>
0054   @since 4.4
0055 */
0056 class ClearErrorAction : public Akonadi::FilterAction
0057 {
0058 public:
0059     /** Creates a ClearErrorAction. */
0060     ClearErrorAction();
0061 
0062     /** Destroys this object. */
0063     ~ClearErrorAction() override;
0064 
0065     Akonadi::ItemFetchScope fetchScope() const override;
0066 
0067     bool itemAccepted(const Akonadi::Item &item) const override;
0068 
0069     Akonadi::Job *itemAction(const Akonadi::Item &item, Akonadi::FilterActionJob *parent) const override;
0070 };
0071 
0072 /**
0073   FilterAction that changes the transport for all messages and
0074   sets the "$QUEUED" flag.
0075 
0076   This is used to send queued messages using an alternative transport.
0077 
0078   @see FilterActionJob
0079 
0080   @author Torgny Nyblom <kde@nyblom.org>
0081   @since 4.5
0082 */
0083 class DispatchManualTransportAction : public Akonadi::FilterAction
0084 {
0085 public:
0086     explicit DispatchManualTransportAction(int transportId);
0087 
0088     ~DispatchManualTransportAction() override;
0089 
0090     Akonadi::ItemFetchScope fetchScope() const override;
0091 
0092     bool itemAccepted(const Akonadi::Item &item) const override;
0093 
0094     Akonadi::Job *itemAction(const Akonadi::Item &item, Akonadi::FilterActionJob *parent) const override;
0095 
0096 private:
0097     const int mTransportId;
0098 };
0099 } // namespace MailTransport