KIMAP

appendjob.h
1/*
2 SPDX-FileCopyrightText: 2009 Kevin Ottens <ervin@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "kimap_export.h"
10
11#include "job.h"
12#include <QDateTime>
13
14namespace KIMAP
15{
16class Session;
17struct Response;
18class AppendJobPrivate;
19
20/**
21 * Appends a message to a mailbox.
22 *
23 * This job can only be run when the session is in the
24 * authenticated (or selected) state.
25 *
26 * If the server supports ACLs, the user will need the
27 * Acl::Insert right on the mailbox.
28 */
29class KIMAP_EXPORT AppendJob : public Job
30{
31 Q_OBJECT
32 Q_DECLARE_PRIVATE(AppendJob)
33
34 friend class SessionPrivate;
35
36public:
37 explicit AppendJob(Session *session);
38 ~AppendJob() override;
39
40 /**
41 * Set the mailbox to append the message to.
42 *
43 * If the mailbox does not exist, it will not automatically
44 * be created and the command will fail.
45 *
46 * @param mailBox the (unquoted) name of the mailbox
47 */
48 void setMailBox(const QString &mailBox);
49 /**
50 * The mailbox that the message will be appended to.
51 */
52 [[nodiscard]] QString mailBox() const;
53
54 /**
55 * Set the flags that should be applied to the appended message.
56 *
57 * @param flags a list of flags
58 */
59 void setFlags(const QList<QByteArray> &flags);
60 /**
61 * The flags that will be set on the appended message.
62 */
63 [[nodiscard]] QList<QByteArray> flags() const;
64
65 /**
66 * Set the internal date that should be applied to the appended message.
67 *
68 * This is the date/time the IMAP server should set internally for the appended message.
69 * See https://tools.ietf.org/html/rfc3501#section-6.3.11
70 *
71 * If this is not set, the server will use the current date/time.
72 *
73 * @param internalDate the internal date
74 *
75 * @since 4.13
76 */
77 void setInternalDate(const QDateTime &internalDate);
78
79 /**
80 * The internal date that will be set on the appended message.
81 *
82 * @since 4.13
83 */
84 [[nodiscard]] QDateTime internalDate() const;
85
86 /**
87 * The content of the message.
88 *
89 * This should be in RFC-2822 format, although some required header
90 * lines may be omitted in certain cases, for example when appending
91 * to a Drafts folder.
92 *
93 * @param content usually an RFC-2822 message
94 */
95 void setContent(const QByteArray &content);
96 /**
97 * The content that the message will have.
98 */
99 [[nodiscard]] QByteArray content() const;
100
101 /**
102 * The UID of the new message.
103 *
104 * This will be zero if it is unknown.
105 *
106 * The UID will not be known until the job has been successfully
107 * executed, and it will only be known at all if the server
108 * supports the UIDPLUS extension (RFC 4315).
109 */
110 [[nodiscard]] qint64 uid() const;
111
112protected:
113 void doStart() override;
114 void handleResponse(const Response &response) override;
115};
116
117}
Appends a message to a mailbox.
Definition appendjob.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:06:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.