File indexing completed on 2024-05-12 05:11:10

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 
0011 #include <Akonadi/AgentInstance>
0012 
0013 // krazy:excludeall=dpointer
0014 
0015 namespace Akonadi
0016 {
0017 /**
0018   @short An interface for applications to interact with the dispatcher agent.
0019 
0020   This class provides methods such as send queued messages (@see
0021   dispatchManually) and retry sending (@see retryDispatching).
0022 
0023   This class also takes care of registering the attributes that the mail
0024   dispatcher agent and MailTransport use.
0025 
0026   @author Constantin Berzan <exit3219@gmail.com>
0027   @since 4.4
0028 */
0029 class AKONADI_MIME_EXPORT DispatcherInterface
0030 {
0031 public:
0032     /**
0033       Creates a new dispatcher interface.
0034     */
0035     DispatcherInterface();
0036 
0037     /**
0038       Returns the current instance of the mail dispatcher agent. May return an invalid
0039       AgentInstance in case it cannot find the mail dispatcher agent.
0040     */
0041     [[nodiscard]] Akonadi::AgentInstance dispatcherInstance() const;
0042 
0043     /**
0044       Looks for messages in the outbox with DispatchMode::Manual and marks them
0045       DispatchMode::Automatic for sending.
0046     */
0047     void dispatchManually();
0048 
0049     /**
0050       Looks for messages in the outbox with ErrorAttribute, and clears them and
0051       queues them again for sending.
0052     */
0053     void retryDispatching();
0054 
0055     /**
0056       Looks for messages in the outbox with DispatchMode::Manual and changes the
0057       Transport for them to the one with id @p transportId.
0058 
0059       @param transportId the transport to dispatch "manual dispatch" messages with
0060       @since 4.5
0061     */
0062     void dispatchManualTransport(int transportId);
0063 };
0064 } // namespace MailTransport