KIMAP2

appendjob.h
1/*
2 Copyright (c) 2009 Kevin Ottens <ervin@kde.org>
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 KIMAP2_APPENDJOB_H
21#define KIMAP2_APPENDJOB_H
22
23#include "kimap2_export.h"
24
25#include "job.h"
26#include <QDateTime>
27
28namespace KIMAP2
29{
30
31class Session;
32struct Message;
33class AppendJobPrivate;
34
35/**
36 * Appends a message to a mailbox.
37 *
38 * This job can only be run when the session is in the
39 * authenticated (or selected) state.
40 *
41 * If the server supports ACLs, the user will need the
42 * Acl::Insert right on the mailbox.
43 */
44class KIMAP2_EXPORT AppendJob : public Job
45{
46 Q_OBJECT
47 Q_DECLARE_PRIVATE(AppendJob)
48
49 friend class SessionPrivate;
50
51public:
52 AppendJob(Session *session);
53 virtual ~AppendJob();
54
55 /**
56 * Set the mailbox to append the message to.
57 *
58 * If the mailbox does not exist, it will not automatically
59 * be created and the command will fail.
60 *
61 * @param mailBox the (unquoted) name of the mailbox
62 */
63 void setMailBox(const QString &mailBox);
64 /**
65 * The mailbox that the message will be appended to.
66 */
67 QString mailBox() const;
68
69 /**
70 * Set the flags that should be applied to the appended message.
71 *
72 * @param flags a list of flags
73 */
74 void setFlags(const QList<QByteArray> &flags);
75 /**
76 * The flags that will be set on the appended message.
77 */
78 QList<QByteArray> flags() const;
79
80 /**
81 * Set the internal date that should be applied to the appended message.
82 *
83 * This is the date/time the IMAP server should set internally for the appended message.
84 * See http://tools.ietf.org/html/rfc3501#section-6.3.11
85 *
86 * If this is not set, the server will use the current date/time.
87 *
88 * @param internalDate the internal date
89 *
90 * @since 4.13
91 */
92 void setInternalDate(const QDateTime &internalDate);
93
94 /**
95 * The internal date that will be set on the appended message.
96 *
97 * @since 4.13
98 */
99 QDateTime internalDate() const;
100
101 /**
102 * The content of the message.
103 *
104 * This should be in RFC-2822 format, although some required header
105 * lines may be omitted in certain cases, for example when appending
106 * to a Drafts folder.
107 *
108 * @param content usually an RFC-2822 message
109 */
110 void setContent(const QByteArray &content);
111 /**
112 * The content that the message will have.
113 */
114 QByteArray content() const;
115
116 /**
117 * The UID of the new message.
118 *
119 * This will be zero if it is unknown.
120 *
121 * The UID will not be known until the job has been successfully
122 * executed, and it will only be known at all if the server
123 * supports the UIDPLUS extension (RFC 4315).
124 */
125 qint64 uid() const;
126
127protected:
128 void doStart() Q_DECL_OVERRIDE;
129 void handleResponse(const Message &response) Q_DECL_OVERRIDE;
130};
131
132}
133
134#endif
Appends a message to a mailbox.
Definition appendjob.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:29 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.