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_OUTBOXACTIONS_P_H
21#define MAILTRANSPORT_OUTBOXACTIONS_P_H
22
23#include <mailtransport/mailtransport_export.h>
24#include <mailtransport/filteractionjob_p.h>
25#include <mailtransport/transportattribute.h>
26
27#include <akonadi/itemfetchscope.h>
28#include <akonadi/job.h>
29
30namespace MailTransport {
31
32/**
33 FilterAction that finds all messages with a DispatchMode of Manual
34 and assigns them a DispatchMode of Immediately.
35
36 This is used to send "queued" messages on demand.
37
38 @see FilterActionJob
39
40 @author Constantin Berzan <exit3219@gmail.com>
41 @since 4.4
42*/
43class SendQueuedAction : public Akonadi::FilterAction
44{
45 public:
46 /** Creates a SendQueuedAction. */
47 SendQueuedAction();
48
49 /** Destroys this object. */
50 virtual ~SendQueuedAction();
51
52 /* reimpl */
53 virtual Akonadi::ItemFetchScope fetchScope() const;
54
55 /* reimpl */
56 virtual bool itemAccepted( const Akonadi::Item &item ) const;
57
58 /* reimpl */
59 virtual Akonadi::Job *itemAction( const Akonadi::Item &item,
60 Akonadi::FilterActionJob *parent ) const;
61
62 private:
63 class Private;
64 Private *const d;
65};
66
67/**
68 FilterAction that finds all messages with an ErrorAttribute,
69 removes the attribute, and sets the "$QUEUED" flag.
70
71 This is used to retry sending messages that failed.
72
73 @see FilterActionJob
74
75 @author Constantin Berzan <exit3219@gmail.com>
76 @since 4.4
77*/
78class ClearErrorAction : public Akonadi::FilterAction
79{
80 public:
81 /** Creates a ClearErrorAction. */
82 ClearErrorAction();
83
84 /** Destroys this object. */
85 virtual ~ClearErrorAction();
86
87 /* reimpl */
88 virtual Akonadi::ItemFetchScope fetchScope() const;
89
90 /* reimpl */
91 virtual bool itemAccepted( const Akonadi::Item &item ) const;
92
93 /* reimpl */
94 virtual Akonadi::Job *itemAction( const Akonadi::Item &item,
95 Akonadi::FilterActionJob *parent ) const;
96
97 private:
98 class Private;
99 Private *const d;
100};
101
102/**
103 FilterAction that changes the transport for all messages and
104 sets the "$QUEUED" flag.
105
106 This is used to send queued messages using an alternative transport.
107
108 @see FilterActionJob
109
110 @author Torgny Nyblom <kde nyblom org>
111 @since 4.5
112*/
113class DispatchManualTransportAction : public Akonadi::FilterAction
114{
115 public:
116 DispatchManualTransportAction( int transportId );
117
118 virtual ~DispatchManualTransportAction();
119
120 /* reimpl */
121 virtual Akonadi::ItemFetchScope fetchScope() const;
122
123 /* reimpl */
124 virtual bool itemAccepted( const Akonadi::Item &item ) const;
125
126 /* reimpl */
127 virtual Akonadi::Job *itemAction( const Akonadi::Item &item,
128 Akonadi::FilterActionJob *parent ) const;
129
130 private:
131 class Private;
132 Private *const d;
133
134 int mTransportId;
135};
136
137} // namespace MailTransport
138
139#endif // MAILTRANSPORT_OUTBOXACTIONS_P_H
140