1/*
2 Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef MAILTRANSPORT_DISPATCHERINTERFACE_H
21#define MAILTRANSPORT_DISPATCHERINTERFACE_H
22
23#include <mailtransport/mailtransport_export.h>
24
25#include <akonadi/agentinstance.h>
26
27//krazy:excludeall=dpointer
28
29namespace MailTransport {
30
31/**
32 @short An interface for applications to interact with the dispatcher agent.
33
34 This class provides methods such as send queued messages (@see
35 dispatchManually) and retry sending (@see retryDispatching).
36
37 This class also takes care of registering the attributes that the mail
38 dispatcher agent and MailTransport use.
39
40 @author Constantin Berzan <exit3219@gmail.com>
41 @since 4.4
42*/
43class MAILTRANSPORT_EXPORT DispatcherInterface
44{
45 public:
46
47 /**
48 Creates a new dispatcher interface.
49 */
50 DispatcherInterface();
51
52 /**
53 Returns the current instance of the mail dispatcher agent. May return an invalid
54 AgentInstance in case it cannot find the mail dispatcher agent.
55 */
56 Akonadi::AgentInstance dispatcherInstance() const;
57
58 /**
59 Looks for messages in the outbox with DispatchMode::Manual and marks them
60 DispatchMode::Automatic for sending.
61 */
62 void dispatchManually();
63
64 /**
65 Looks for messages in the outbox with ErrorAttribute, and clears them and
66 queues them again for sending.
67 */
68 void retryDispatching();
69
70 /**
71 Looks for messages in the outbox with DispatchMode::Manual and changes the
72 Transport for them to the one with id @p transportId.
73
74 @param transportId the transport to dispatch "manual dispatch" messages with
75 @since 4.5
76 */
77 void dispatchManualTransport( int transportId );
78};
79
80} // namespace MailTransport
81
82#endif // MAILTRANSPORT_DISPATCHERINTERFACE_H
83