1 ///
2 module imap.defines;
3 import std.stdio;
4 import deimos.openssl.ssl;
5 import imap.socket;
6 import imap.sil : SILdoc;
7 import core.sys.posix.sys.stat;
8 
9 static if (is(size_t == uint)) {
10     alias ssize_t = int;
11 } else {
12     alias ssize_t = long;
13 }
14 
15 
16 @SILdoc("IMAP protocol supported by the server")
17 enum ImapProtocol {
18     none = 0,
19     imap4Rev1 = 1,
20     imap4 = 2,
21 }
22 
23 @SILdoc("Capabilities of mail server")
24 enum Capability {
25     none = 0x00,
26 
27     @("NAMESPACE")
28     namespace = 0x01,
29 
30     @("AUTH=CRAM-MD5")
31     cramMD5 = 0x02,
32 
33     @("STARTTLS")
34     startTLS = 0x04,
35 
36     @("CHILDREN")
37     children = 0x08,
38 
39     @("IDLE")
40     idle = 0x10,
41 
42     @("IMAP4rev1")
43     imap4Rev1,
44 
45     @("IMAP4")
46     imap4,
47 
48     @("LITERAL+")
49     literalPlus,
50 
51     @("ID")
52     id,
53 
54     @("ENABLE")
55     enable,
56 
57     @("ACL")
58     acl,
59 
60     @("RIGHTS=kxten")
61     rightsKxTen,
62 
63     @("QUOTA")
64     quota,
65 
66     @("MAILBOX-REFERRALS")
67     mailboxReferrals,
68 
69     @("UIDPLUS")
70     uidPlus,
71 
72     @("NO_ATOMIC_RENAME")
73     noAtomicRename,
74 
75     @("UNSELECT")
76     unselect,
77 
78     @("MULTIAPPEND")
79     multiAppend,
80 
81     @("MULTISEARCH")
82     multiSearch,
83 
84     @("BINARY")
85     binary,
86 
87     @("CATENATE")
88     catenate,
89 
90     @("CONDSTORE")
91     condStore,
92 
93     @("ESEARCH")
94     esearch,
95 
96     @("SEARCH=FUZZY")
97     fuzzySearch,
98 
99     @("SORT")
100     sort,
101 
102     @("SORT=MODSEQ")
103     sortModSeq,
104 
105     @("SORT=DISPLAY")
106     sortDisplay,
107 
108     @("SORT=UID")
109     sortUID,
110 
111     @("THREAD=ORDEREDSUBJECT")
112     threadOrderedSubject,
113 
114     @("THREAD=REFERENCES")
115     threadReferences,
116 
117     @("THREAD=REFS")
118     threadRefs,
119 
120     @("ANNOTATE-EXPERIMENT-1")
121     annotateExperiment1,
122 
123     @("METADATA")
124     metadata,
125 
126     @("LIST-EXTENDED")
127     listExtended,
128 
129     @("LIST-STATUS")
130     listStatus,
131 
132     @("LIST-MYRIGHTS")
133     listMyRights,
134 
135     @("LIST-METADATA")
136     listMetadata,
137 
138     @("WITHIN")
139     within,
140 
141     @("QRESYNC")
142     qResync,
143 
144     @("SCAN")
145     scan,
146 
147     @("XLIST")
148     xlist,
149 
150     @("MOVE")
151     move,
152 
153     @("SPECIAL-USE")
154     specialUse,
155 
156     @("CREATE-SPECIAL-USE")
157     createSpecialUse,
158 
159     @("DIGEST=SHA1")
160     digestSHA1,
161 
162     @("X-REPLICATION")
163     xReplication,
164 
165     @("STATUS=SIZE")
166     statusSize,
167 
168     @("OBJECTID")
169     objectID,
170 
171     @("SAVEDATE")
172     saveDate,
173 
174     @("X-CREATEDMODSEQ")
175     xCreatedModSeq,
176 
177     @("PREVIEW=FUZZY")
178     previewFuzzy,
179 
180     @("XAPPLEPUSHSERVICE")
181     xApplePushService,
182 
183     @("LOGINDISABLED")
184     loginDisabled,
185 
186     @("XCONVERSATIONS")
187     xConversations,
188 
189     @("COMPRESS=DEFLATE")
190     compressDeflate,
191 
192     @("X-QUOTA=STORAGE")
193     xQuoteStorage,
194 
195     @("X-QUOTA=MESSAGE")
196     xQuotaMessage,
197 
198     @("X-QUOTA=X-ANNOTATION-STORAGE")
199     xQuotaXAnnotationStorage,
200 
201     @("X-QUOTA=X-NUM-FOLDERS")
202     xQuotaXNumFolders,
203 
204     @("XMOVE")
205     xMove,
206 }
207 
208 @SILdoc("Status responses and response codes")
209 enum ImapStatus {
210     none = 0,
211 
212     @("OK")
213     ok = 1,
214 
215     @("NO")
216     no = 2,
217 
218     @("BAD")
219     bad = 3,
220 
221     untagged = 4,
222     continue_ = 5,
223     bye = 6,
224     preAuth = 7,
225     readOnly = 8,
226     tryCreate = 9,
227     timeout = 10,
228     unknown = -1,
229 }
230 
231 ///
232 enum ImapFlag {
233     @(`\Seen`)
234     seen,
235 
236     @(`\Answered`)
237     answered,
238 
239     @(`\Flagged`)
240     flagged,
241 
242     @(`\Deleted`)
243     deleted,
244 
245     @(`\Draft`)
246     draft,
247 }
248