KIMAP

copyjob.h
1/*
2 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@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 "imapset.h"
12#include "job.h"
13
14namespace KIMAP
15{
16class Session;
17struct Message;
18class CopyJobPrivate;
19
20/**
21 * Copies one or more messages to another mailbox.
22 *
23 * This job can only be run when the session is in the selected state.
24 *
25 * If the server supports ACLs, the user will need the
26 * Acl::Insert right on the target mailbox.
27 * In order to preserve message flags, the user may also need
28 * some combination of Acl::DeleteMessage,
29 * Acl::KeepSeen and Acl::Write on the
30 * target mailbox.
31 */
32class KIMAP_EXPORT CopyJob : public Job
33{
34 Q_OBJECT
35 Q_DECLARE_PRIVATE(CopyJob)
36
37 friend class SessionPrivate;
38
39public:
40 explicit CopyJob(Session *session);
41 ~CopyJob() override;
42
43 /**
44 * Sets the destination mailbox.
45 *
46 * If the mailbox does not exist, the server should not create
47 * it automatically and the job should fail. Note, however,
48 * that a conforming server may create the mailbox automatically.
49 *
50 * @param mailBox the (unquoted) name of the mailbox where the
51 * messages should be copied to
52 */
53 void setMailBox(const QString &mailBox);
54 /**
55 * The destination mailbox
56 */
57 [[nodiscard]] QString mailBox() const;
58
59 /**
60 * Sets the messages to be copied
61 *
62 * If sequence numbers are given, isUidBased() should be false. If UIDs
63 * are given, isUidBased() should be true.
64 *
65 * RFC 3501 is unclear as to what should happen if invalid sequence numbers
66 * are passed. If non-existent UIDs are passed, they will be ignored.
67 *
68 * @param set the sequence numbers or UIDs of the messages to be copied
69 */
70 void setSequenceSet(const ImapSet &set);
71 /**
72 * The messages that will be copied.
73 *
74 * isUidBased() can be used to check whether the ImapSet contains
75 * sequence numbers or UIDs.
76 *
77 * @return the sequence numbers or UIDs of the messages to be copied
78 */
79 [[nodiscard]] ImapSet sequenceSet() const;
80
81 /**
82 * Set how the sequence set should be interpreted.
83 *
84 * @param uidBased if @c true the argument to setSequenceSet will be
85 * interpreted as UIDs, if @c false it will be interpreted
86 * as sequence numbers
87 */
88 void setUidBased(bool uidBased);
89 /**
90 * How to interpret the sequence set.
91 *
92 * @return if @c true the result of sequenceSet() should be
93 * interpreted as UIDs, if @c false it should be interpreted
94 * as sequence numbers
95 */
96 [[nodiscard]] bool isUidBased() const;
97
98 /**
99 * The UIDs of the new copies of the messages
100 *
101 * This will be an empty set if no messages have been copied yet
102 * or if the server does not support the UIDPLUS extension.
103 */
104 [[nodiscard]] ImapSet resultingUids() const;
105
106protected:
107 void doStart() override;
108 void handleResponse(const Response &response) override;
109};
110
111}
Copies one or more messages to another mailbox.
Definition copyjob.h:33
Represents a set of natural numbers (1->∞) in a as compact as possible form.
Definition imapset.h:127
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:52:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.