~ubuntu-branches/debian/stretch/alpine/stretch

« back to all changes in this revision

Viewing changes to imap/src/c-client/imap4r1.h

  • Committer: Bazaar Package Importer
  • Author(s): Asheesh Laroia
  • Date: 2007-02-17 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20070217131742-99x5c6cpg1pbkdhw
Tags: upstream-0.82+dfsg
ImportĀ upstreamĀ versionĀ 0.82+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ========================================================================
 
2
 * Copyright 1988-2006 University of Washington
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * 
 
11
 * ========================================================================
 
12
 */
 
13
 
 
14
/*
 
15
 * Program:     Interactive Mail Access Protocol 4rev1 (IMAP4R1) routines
 
16
 *
 
17
 * Author:      Mark Crispin
 
18
 *              Networks and Distributed Computing
 
19
 *              Computing & Communications
 
20
 *              University of Washington
 
21
 *              Administration Building, AG-44
 
22
 *              Seattle, WA  98195
 
23
 *              Internet: MRC@CAC.Washington.EDU
 
24
 *
 
25
 * Date:        14 October 1988
 
26
 * Last Edited: 6 December 2006
 
27
 */
 
28
 
 
29
 
 
30
/* This include file is provided for applications which need to look under
 
31
 * the covers at the IMAP driver and in particular want to do different
 
32
 * operations depending upon the IMAP server's protocol level and
 
33
 * capabilities.  It is NOT included in the normal c-client.h application
 
34
 * export, and most applications do NOT need the definitions in this file.
 
35
 *
 
36
 * As of October 15, 2003, it is believed that:
 
37
 *
 
38
 * Version      RFC             Status          Known Implementations
 
39
 * -------      ---             ------          ---------------------
 
40
 * IMAP1        none            extinct         experimental TOPS-20 server
 
41
 * IMAP2        1064            extinct         old TOPS-20, SUMEX servers
 
42
 * IMAP2        1176            rare            TOPS-20, old UW servers
 
43
 * IMAP2bis     expired I-D     uncommon        old UW, Cyrus servers
 
44
 * IMAP3        1203            extinct         none (never implemented)
 
45
 * IMAP4        1730            rare            old UW, Cyrus, Netscape servers
 
46
 * IMAP4rev1    2060, 3501      ubiquitous      UW, Cyrus, and many others
 
47
 *
 
48
 * Most client implementations will only interoperate with an IMAP4rev1
 
49
 * server.  c-client based client implementations can interoperate with IMAP2,
 
50
 * IMAP2bis, IMAP4, and IMAP4rev1 servers, but only if they are very careful.
 
51
 *
 
52
 * The LEVELxxx() macros in this file enable the client to determine the
 
53
 * server protocol level and capabilities.  This file also contains a few
 
54
 * backdoor calls into the IMAP driver.
 
55
 */
 
56
 
 
57
/* Server protocol level and capabilities */
 
58
 
 
59
typedef struct imap_cap {
 
60
  unsigned int rfc1176 : 1;     /* server is RFC-1176 IMAP2 */
 
61
  unsigned int imap2bis : 1;    /* server is IMAP2bis */
 
62
  unsigned int imap4 : 1;       /* server is IMAP4 (RFC 1730) */
 
63
  unsigned int imap4rev1 : 1;   /* server is IMAP4rev1 */
 
64
  unsigned int acl : 1;         /* server has ACL (RFC 2086) */
 
65
  unsigned int quota : 1;       /* server has QUOTA (RFC 2087) */
 
66
  unsigned int litplus : 1;     /* server has LITERAL+ (RFC 2088) */
 
67
  unsigned int idle : 1;        /* server has IDLE (RFC 2177) */
 
68
  unsigned int mbx_ref : 1;     /* server has mailbox referrals (RFC 2193) */
 
69
  unsigned int log_ref : 1;     /* server has login referrals (RFC 2221) */
 
70
  unsigned int authanon : 1;    /* server has anonymous SASL (RFC 2245) */
 
71
  unsigned int namespace :1;    /* server has NAMESPACE (RFC 2342) */
 
72
  unsigned int uidplus : 1;     /* server has UIDPLUS (RFC 2359) */
 
73
  unsigned int starttls : 1;    /* server has STARTTLS (RFC 2595) */
 
74
                                /* server disallows LOGIN command (RFC 2595) */
 
75
  unsigned int logindisabled : 1;
 
76
  unsigned int id : 1;          /* server has ID (RFC 2971) */
 
77
  unsigned int children : 1;    /* server has CHILDREN (RFC 3348) */
 
78
  unsigned int multiappend : 1; /* server has multi-APPEND (RFC 3502) ;*/
 
79
  unsigned int binary : 1;      /* server has BINARY (RFC 3516) */
 
80
  unsigned int unselect : 1;    /* server has UNSELECT */
 
81
  unsigned int sasl_ir : 1;     /* server has SASL-IR initial response */
 
82
  unsigned int sort : 1;        /* server has SORT */
 
83
  unsigned int scan : 1;        /* server has SCAN */
 
84
  unsigned int extlevel;        /* extension data level supported by server */
 
85
                                /* supported authenticators */
 
86
  unsigned int auth : MAXAUTHENTICATORS;
 
87
  THREADER *threader;           /* list of threaders */
 
88
} IMAPCAP;
 
89
 
 
90
/* IMAP4rev1 level or better */
 
91
 
 
92
#define LEVELIMAP4rev1(stream) imap_cap (stream)->imap4rev1
 
93
 
 
94
#define LEVELSTATUS LEVELIMAP4rev1
 
95
 
 
96
 
 
97
/* IMAP4 level or better (not including RFC 1730 design mistakes) */
 
98
 
 
99
#define LEVELIMAP4(stream) (imap_cap (stream)->imap4rev1 || \
 
100
                            imap_cap (stream)->imap4)
 
101
 
 
102
 
 
103
/* IMAP4 RFC-1730 level */
 
104
 
 
105
#define LEVEL1730(stream) imap_cap (stream)->imap4
 
106
 
 
107
 
 
108
/* IMAP2bis level or better */
 
109
 
 
110
#define LEVELIMAP2bis(stream) imap_cap (stream)->imap2bis
 
111
 
 
112
 
 
113
/* IMAP2 RFC-1176 level or better */
 
114
 
 
115
#define LEVEL1176(stream) imap_cap (stream)->rfc1176
 
116
 
 
117
 
 
118
/* IMAP2 RFC-1064 or better */
 
119
 
 
120
#define LEVEL1064(stream) 1
 
121
 
 
122
/* Has ACL extension */
 
123
 
 
124
#define LEVELACL(stream) imap_cap (stream)->acl
 
125
 
 
126
 
 
127
/* Has QUOTA extension */
 
128
 
 
129
#define LEVELQUOTA(stream) imap_cap (stream)->quota
 
130
 
 
131
 
 
132
/* Has LITERALPLUS extension */
 
133
 
 
134
#define LEVELLITERALPLUS(stream) imap_cap (stream)->litplus
 
135
 
 
136
 
 
137
/* Has IDLE extension */
 
138
 
 
139
#define LEVELIDLE(stream) imap_cap (stream)->idle
 
140
 
 
141
 
 
142
/* Has mailbox referrals */
 
143
 
 
144
#define LEVELMBX_REF(stream) imap_cap (stream)->mbx_ref
 
145
 
 
146
 
 
147
/* Has login referrals */
 
148
 
 
149
#define LEVELLOG_REF(stream) imap_cap (stream)->log_ref
 
150
 
 
151
 
 
152
/* Has AUTH=ANONYMOUS extension */
 
153
 
 
154
#define LEVELANONYMOUS(stream) imap_cap (stream)->authanon
 
155
 
 
156
 
 
157
/* Has NAMESPACE extension */
 
158
 
 
159
#define LEVELNAMESPACE(stream) imap_cap (stream)->namespace
 
160
 
 
161
 
 
162
/* Has UIDPLUS extension */
 
163
 
 
164
#define LEVELUIDPLUS(stream) imap_cap (stream)->uidplus
 
165
 
 
166
 
 
167
/* Has STARTTLS extension */
 
168
 
 
169
#define LEVELSTARTTLS(stream) imap_cap (stream)->starttls
 
170
 
 
171
 
 
172
/* Has LOGINDISABLED extension */
 
173
 
 
174
#define LEVELLOGINDISABLED(stream) imap_cap (stream)->logindisabled
 
175
 
 
176
/* Has ID extension */
 
177
 
 
178
#define LEVELID(stream) imap_cap (stream)->id
 
179
 
 
180
 
 
181
/* Has CHILDREN extension */
 
182
 
 
183
#define LEVELCHILDREN(stream) imap_cap (stream)->children
 
184
 
 
185
 
 
186
/* Has MULTIAPPEND extension */
 
187
 
 
188
#define LEVELMULTIAPPEND(stream) imap_cap (stream)->multiappend
 
189
 
 
190
 
 
191
/* Has BINARY extension */
 
192
 
 
193
#define LEVELBINARY(stream) imap_cap (stream)->binary
 
194
 
 
195
 
 
196
/* Has UNSELECT extension */
 
197
 
 
198
#define LEVELUNSELECT(stream) imap_cap (stream)->unselect
 
199
 
 
200
 
 
201
/* Has SASL initial response extension */
 
202
 
 
203
#define LEVELSASLIR(stream) imap_cap (stream)->sasl_ir
 
204
 
 
205
 
 
206
/* Has SORT extension */
 
207
 
 
208
#define LEVELSORT(stream) imap_cap (stream)->sort
 
209
 
 
210
 
 
211
/* Has at least one THREAD extension */
 
212
 
 
213
#define LEVELTHREAD(stream) ((imap_cap (stream)->threader) ? T : NIL)
 
214
 
 
215
/* Has SCAN extension */
 
216
 
 
217
#define LEVELSCAN(stream) imap_cap (stream)->scan
 
218
 
 
219
/* Body structure extension levels */
 
220
 
 
221
/* These are in BODYSTRUCTURE order.  Note that multipart bodies do not have
 
222
 * body-fld-md5.  This is alright, since all subsequent body structure
 
223
 * extensions are in both singlepart and multipart bodies.  If that ever
 
224
 * changes, this will have to be split.
 
225
 */
 
226
 
 
227
#define BODYEXTMD5 1            /* body-fld-md5 */
 
228
#define BODYEXTDSP 2            /* body-fld-dsp */
 
229
#define BODYEXTLANG 3           /* body-fld-lang */
 
230
#define BODYEXTLOC 4            /* body-fld-loc */
 
231
 
 
232
 
 
233
/* Function prototypes */
 
234
 
 
235
IMAPCAP *imap_cap (MAILSTREAM *stream);
 
236
char *imap_host (MAILSTREAM *stream);
 
237
long imap_cache (MAILSTREAM *stream,unsigned long msgno,char *seg,
 
238
                 STRINGLIST *stl,SIZEDTEXT *text);
 
239
 
 
240
 
 
241
/* Temporary */
 
242
 
 
243
long imap_setacl (MAILSTREAM *stream,char *mailbox,char *id,char *rights);
 
244
long imap_deleteacl (MAILSTREAM *stream,char *mailbox,char *id);
 
245
long imap_getacl (MAILSTREAM *stream,char *mailbox);
 
246
long imap_listrights (MAILSTREAM *stream,char *mailbox,char *id);
 
247
long imap_myrights (MAILSTREAM *stream,char *mailbox);
 
248
long imap_setquota (MAILSTREAM *stream,char *qroot,STRINGLIST *limits);
 
249
long imap_getquota (MAILSTREAM *stream,char *qroot);
 
250
long imap_getquotaroot (MAILSTREAM *stream,char *mailbox);