File indexing completed on 2024-05-12 05:17:12
0001 /* 0002 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kimap_export.h" 0010 0011 #include <qglobal.h> 0012 0013 namespace KIMAP 0014 { 0015 /** 0016 * Operations for dealing with mailbox permissions. 0017 */ 0018 namespace Acl 0019 { 0020 /** 0021 * Possible rights that can be held on a mailbox 0022 */ 0023 enum Right { 0024 None = 0x000000, 0025 /** Mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox */ 0026 Lookup = 0x000001, 0027 /** SELECT the mailbox, perform STATUS */ 0028 Read = 0x000002, 0029 /** Set or clear the \Seen flag on messages in the mailbox, and keep it across sessions */ 0030 KeepSeen = 0x000004, 0031 /** Set or clear flags other than \Seen and \Deleted on messages in the mailbox */ 0032 Write = 0x000008, 0033 /** Perform APPEND and COPY with the mailbox as the target */ 0034 Insert = 0x000010, 0035 /** Send mail to the submission address for the mailbox 0036 * 0037 * Note: this is not enforced by IMAP4, but is purely advisory. 0038 */ 0039 Post = 0x000020, 0040 /** Obsolete as of RFC 4314, replaced by CreateMailbox and DeleteMailbox */ 0041 Create = 0x000040, 0042 /** Create new child mailboxes, or move a mailbox with this mailbox as the new parent 0043 * 0044 * Note that what constitutes a "child" mailbox is implementation-defined, but 0045 * . or / are usually used as separaters. 0046 */ 0047 CreateMailbox = 0x000080, 0048 /** Delete or move the mailbox */ 0049 DeleteMailbox = 0x000100, 0050 /** Set or clear the \Deleted flag on messages in the mailbox */ 0051 DeleteMessage = 0x000200, 0052 /** Obsolete as of RFC 4314, replaced by DeleteMessage and Expunge*/ 0053 Delete = 0x000400, 0054 /** View and modify the access control list for the mailbox */ 0055 Admin = 0x000800, 0056 /** Expunge the messages in this mailbox 0057 * 0058 * Note that if this right is not held on a mailbox, closing the mailbox 0059 * (see CloseJob) will succeed, but will not expunge the messages. 0060 */ 0061 Expunge = 0x001000, 0062 /** Write shared annotations 0063 * 0064 * See <a href="https://tools.ietf.org/html/rfc5257" title="IMAP ANNOTATE extension">RFC 0065 * 5257</a>. Only supported by servers that implement the ANNOTATE extension. 0066 */ 0067 WriteShared = 0x002000, 0068 Custom0 = 0x004000, /**< Server-specific right 0 */ 0069 Custom1 = 0x008000, /**< Server-specific right 1 */ 0070 Custom2 = 0x010000, /**< Server-specific right 2 */ 0071 Custom3 = 0x020000, /**< Server-specific right 3 */ 0072 Custom4 = 0x040000, /**< Server-specific right 4 */ 0073 Custom5 = 0x080000, /**< Server-specific right 5 */ 0074 Custom6 = 0x100000, /**< Server-specific right 6 */ 0075 Custom7 = 0x200000, /**< Server-specific right 7 */ 0076 Custom8 = 0x400000, /**< Server-specific right 8 */ 0077 Custom9 = 0x800000 /**< Server-specific right 9 */ 0078 }; 0079 0080 Q_DECLARE_FLAGS(Rights, Right) 0081 0082 /** 0083 * Returns a rights mask that has no obsolete members anymore, i.e. obsolete flags are removed and 0084 * replaced by their successors. 0085 * @param rights set of #Rights flags to normalize 0086 * @since 4.6 0087 */ 0088 KIMAP_EXPORT Rights normalizedRights(Rights rights); 0089 0090 /** 0091 * Returns a rights mask that contains both obsolete and new flags if one of them is set. 0092 * @param rights set of #Rights flags to augment 0093 * @since 4.6 0094 */ 0095 KIMAP_EXPORT Rights denormalizedRights(Rights rights); 0096 0097 /** 0098 * Convert a set of rights into text format 0099 * 0100 * No modifier flag ('+' or '-') will be included. 0101 */ 0102 KIMAP_EXPORT QByteArray rightsToString(Rights rights); 0103 /** 0104 * Convert the text form of a set of rights into a Rights bitflag 0105 * 0106 * Modifier flags ('+' and '-') are ignored, as are any unknown 0107 * characters. This method will not complain if you give it 0108 * something that is not a list of rights. 0109 */ 0110 KIMAP_EXPORT Rights rightsFromString(const QByteArray &string); 0111 0112 } 0113 } 0114 0115 Q_DECLARE_OPERATORS_FOR_FLAGS(KIMAP::Acl::Rights)