File indexing completed on 2024-05-12 05:17:24
0001 /* 0002 Copyright (c) 2009 Andras Mantia <amantia@kde.org> 0003 0004 This library is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to the 0016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0017 02110-1301, USA. 0018 */ 0019 0020 #ifndef KIMAP2_METADATAJOBBASE_H 0021 #define KIMAP2_METADATAJOBBASE_H 0022 0023 #include "kimap2_export.h" 0024 0025 #include "job.h" 0026 0027 namespace KIMAP2 0028 { 0029 0030 class Session; 0031 struct Message; 0032 class MetaDataJobBasePrivate; 0033 0034 /** 0035 * Base class for jobs that operate on mailbox metadata 0036 * 0037 * Provides support for the IMAP METADATA extension; both the 0038 * final RFC version 0039 * (<a href="http://tools.ietf.org/html/rfc5464">RFC 5464</a>) 0040 * and the older, incompatible draft version (known as ANNOTATEMORE) 0041 * (<a 0042 * href="http://tools.ietf.org/html/draft-daboo-imap-annotatemore-07" 0043 * >draft-daboo-imap-annotatemore-07</a>). 0044 * 0045 * This class cannot be used directly, you must subclass it and reimplement 0046 * at least the doStart() method. 0047 */ 0048 class KIMAP2_EXPORT MetaDataJobBase : public Job 0049 { 0050 Q_OBJECT 0051 Q_DECLARE_PRIVATE(MetaDataJobBase) 0052 0053 friend class SessionPrivate; 0054 0055 public: 0056 explicit MetaDataJobBase(Session *session); 0057 virtual ~MetaDataJobBase(); 0058 0059 /** 0060 * Represents the capability level of the server. 0061 */ 0062 enum ServerCapability { 0063 /** 0064 * Used to indicate that the server supports the RFC 5464 version 0065 * of the extension. 0066 * 0067 * This corresponds to the METADATA server capability. 0068 */ 0069 Metadata = 0, 0070 /** 0071 * Used to indicate that the server supports the 0072 * draft-daboo-imap-annotatemore-07 version of the extension. 0073 * 0074 * This corresponds to the ANNOTATEMORE server capability. 0075 */ 0076 Annotatemore 0077 }; 0078 0079 /** 0080 * Set the mailbox to act on 0081 * 0082 * This may be an empty string, in which case metadata for the 0083 * server (rather than a specific mailbox) will be retrieved. 0084 * 0085 * @param mailBox the name of an existing mailbox, or an empty string 0086 */ 0087 void setMailBox(const QString &mailBox); 0088 /** 0089 * The mailbox that will be acted upon. 0090 * 0091 * If this is an empty string, server metadata will be retrieved. 0092 * 0093 * @return a mailbox name, or an empty string 0094 */ 0095 QString mailBox() const; 0096 0097 /** 0098 * Set what version of the metadata extension to be compatible with. 0099 * 0100 * This will determine the commands that will be sent to the server. 0101 * 0102 * The draft for the metadata extension changed in an incompatible 0103 * way between versions 7 and 8, and some servers support version 7. 0104 * It should be possible to check which version the server supports 0105 * using CapabilityJob: servers implementing 0106 * draft-daboo-imap-annotatemore-07 should advertise the 0107 * ANNOTATEMORE capability, whereas servers implementing the final 0108 * RFC 5464 should advertise the METADATA capability. 0109 * 0110 * The default mode is Metadata. 0111 * 0112 * @param capability the version of the extension implemented by the server 0113 */ 0114 void setServerCapability(ServerCapability capability); 0115 /** 0116 * The version of the metadata extension that will be used. 0117 */ 0118 ServerCapability serverCapability() const; 0119 0120 protected: 0121 MetaDataJobBase(JobPrivate &dd); 0122 0123 }; 0124 0125 } 0126 0127 #endif