KIMAP2

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

KDE's Doxygen guidelines are available online.