Debian Codegraph @

Framework/Pantomime/CWIMAPStore.h

raw symbols SCIP
1 /*
2 ** CWIMAPStore.h
3 **
4 ** Copyright (c) 2001-2007 Ludovic Marcotte
5 **
6 ** Author: Ludovic Marcotte <[email protected]>
7 **
8 ** This library is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU Lesser General Public
10 ** License as published by the Free Software Foundation; either
11 ** version 2.1 of the License, or (at your option) any later version.
12 **
13 ** This library is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ** Lesser General Public License for more details.
17 **
18 ** You should have received a copy of the GNU General Public License
19 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifndef _Pantomime_H_CWIMAPStore
23 #define _Pantomime_H_CWIMAPStore
24
25 #include <Pantomime/CWConnection.h>
26 #include <Pantomime/CWConstants.h>
27 #include <Pantomime/CWService.h>
28 #include <Pantomime/CWStore.h>
29
30 #import <Foundation/NSArray.h>
31 #import <Foundation/NSDictionary.h>
32 #import <Foundation/NSObject.h>
33 #import <Foundation/NSString.h>
34
35 /*!
36 @typedef IMAPCommand
37 @abstract Supported IMAP commands.
38 @discussion This enum lists the supported IMAP commands available in Pantomime's IMAP client code.
39 @constant IMAP_APPEND The IMAP APPEND command - see 6.3.11. APPEND Command of RFC 3501.
40 @constant IMAP_AUTHENTICATE_CRAM_MD5 CRAM-MD5 authentication.
41 @constant IMAP_AUTHENTICATE_LOGIN LOGIN authentication
42 @constant IMAP_AUTHORIZATION Special command so that we know we are in the authorization state.
43 @constant IMAP_CAPABILITY The IMAP CAPABILITY command - see 6.1.1. CAPABILITY Command of RFC 3501.
44 @constant IMAP_CLOSE The IMAP CLOSE command - see 6.4.2. CLOSE Command of RFC 3501.
45 @constant IMAP_CREATE The IMAP CREATE command - see 6.3.3. CREATE Command of RFC 3501.
46 @constant IMAP_DELETE The IMAP DELETE command - see 6.3.4. DELETE Command of RFC 3501.
47 @constant IMAP_EXAMINE The IMAP EXAMINE command - see 6.3.2. EXAMINE Command of RFC 3501.
48 @constant IMAP_EXPUNGE The IMAP EXPUNGE command - see 6.4.3. EXPUNGE Command of RFC 3501.
49 @constant IMAP_LIST The IMAP LIST command - see 6.3.8. LIST Command of RFC 3501.
50 @constant IMAP_LOGIN The IMAP LOGIN command - see 6.2.3. LOGIN Command of RFC 3501.
51 @constant IMAP_LOGOUT The IMAP LOGOUT command - see 6.1.3. LOGOUT Command of RFC 3501.
52 @constant IMAP_LSUB The IMAP LSUB command - see 6.3.9. LSUB Command of RFC 3501.
53 @constant IMAP_NOOP The IMAP NOOP command - see 6.1.2. NOOP Command of RFC 3501.
54 @constant IMAP_RENAME The IMAP RENAME command - see 6.3.5. RENAME Command of RFC 3501.
55 @constant IMAP_SELECT The IMAP SELECT command - see 6.3.1. SELECT Command of RFC 3501.
56 @constant IMAP_STARTTLS The STARTTLS IMAP command - see RFC2595.
57 @constant IMAP_STATUS The IMAP STATUS command - see 6.3.10. STATUS Command of RFC 3501.
58 @constant IMAP_SUBSCRIBE The IMAP SUBSCRIBE command - see 6.3.6. SUBSCRIBE Command of RFC 3501.
59 @constant IMAP_UID_COPY The IMAP COPY command - see 6.4.7. COPY Command of RFC 3501.
60 @constant IMAP_UID_FETCH_BODY_TEXT The IMAP FETCH command - see 6.4.5. FETCH Command of RFC 3501.
61 @constant IMAP_UID_FETCH_HEADER_FIELDS The IMAP FETCH command - see 6.4.5. FETCH Command of RFC 3501.
62 @constant IMAP_UID_FETCH_HEADER_FIELDS_NOT The IMAP FETCH command - see 6.4.5. FETCH Command of RFC 3501.
63 @constant IMAP_UID_FETCH_RFC822 The IMAP FETCH command - see 6.4.5. FETCH Command of RFC 3501.
64 @constant IMAP_UID_SEARCH The IMAP SEARCH command - see 6.4.4. SEARCH Command of RFC 3501.
65 Used to update the IMAP Folder cache.
66 @constant IMAP_UID_SEARCH_ALL The IMAP SEARCH command - see 6.4.4. SEARCH Command of RFC 3501.
67 @constant IMAP_UID_SEARCH_ANSWERED Special command used to update the IMAP Folder cache.
68 @constant IMAP_UID_SEARCH_FLAGGED Special command used to update the IMAP Folder cache.
69 @constant IMAP_UID_SEARCH_UNSEEN Special command used to update the IMAP Folder cache.
70 @constant IMAP_UID_STORE The IMAP STORE command - see 6.4.6. STORE Command of RFC 3501.
71 @constant IMAP_UNSUBSCRIBE The IMAP UNSUBSCRIBE command - see 6.3.7. UNSUBSCRIBE Command of RFC 3501.
72 @constant IMAP_EMPTY_QUEUE Special command to empty the command queue.
73 */
74 typedef enum {
75 IMAP_APPEND = 0x1,
76 IMAP_AUTHENTICATE_CRAM_MD5,
77 IMAP_AUTHENTICATE_LOGIN,
78 IMAP_AUTHORIZATION,
79 IMAP_CAPABILITY,
80 IMAP_CLOSE,
81 IMAP_CREATE,
82 IMAP_DELETE,
83 IMAP_EXAMINE,
84 IMAP_EXPUNGE,
85 IMAP_LIST,
86 IMAP_LOGIN,
87 IMAP_LOGOUT,
88 IMAP_LSUB,
89 IMAP_NOOP,
90 IMAP_RENAME,
91 IMAP_SELECT,
92 IMAP_STARTTLS,
93 IMAP_STATUS,
94 IMAP_SUBSCRIBE,
95 IMAP_UID_COPY,
96 IMAP_UID_FETCH_BODY_TEXT,
97 IMAP_UID_FETCH_HEADER_FIELDS,
98 IMAP_UID_FETCH_HEADER_FIELDS_NOT,
99 IMAP_UID_FETCH_RFC822,
100 IMAP_UID_SEARCH,
101 IMAP_UID_SEARCH_ALL,
102 IMAP_UID_SEARCH_ANSWERED,
103 IMAP_UID_SEARCH_FLAGGED,
104 IMAP_UID_SEARCH_UNSEEN,
105 IMAP_UID_STORE,
106 IMAP_UNSUBSCRIBE,
107 IMAP_EMPTY_QUEUE
108 } IMAPCommand;
109
110 /*!
111 @const PantomimeFolderSubscribeCompleted
112 */
113 extern NSString *PantomimeFolderSubscribeCompleted;
114
115 /*!
116 @const PantomimeFolderSubscribeFailed
117 */
118 extern NSString *PantomimeFolderSubscribeFailed;
119
120 /*!
121 @const PantomimeFolderUnsubscribeCompleted
122 */
123 extern NSString *PantomimeFolderUnsubscribeCompleted;
124
125 /*!
126 @const PantomimeFolderUnsubscribeFailed
127 */
128 extern NSString *PantomimeFolderUnsubscribeFailed;
129
130 /*!
131 @const PantomimeFolderStatusCompleted
132 */
133 extern NSString *PantomimeFolderStatusCompleted;
134
135 /*!
136 @const PantomimeFolderStatusFailed
137 */
138 extern NSString *PantomimeFolderStatusFailed;
139
140
141 @class CWConnection;
142 @class CWFlags;
143 @class CWIMAPCacheManager;
144 @class CWIMAPFolder;
145 @class CWIMAPMessage;
146 @class CWIMAPQueueObject;
147 @class CWTCPConnection;
148
149 /*!
150 @class CWIMAPStore
151 @abstract Pantomime IMAP client code.
152 @discussion This class, which extends the CWService class and implements
153 the CWStore protocol, is Pantomime's IMAP client code.
154 */
155 @interface CWIMAPStore : CWService <CWStore>
156 {
157 @private
158 CWIMAPQueueObject *_currentQueueObject;
159
160 NSMutableDictionary *_folders;
161 NSMutableDictionary *_openFolders;
162 NSMutableDictionary *_folderStatus;
163 NSMutableArray *_subscribedFolders;
164
165 CWIMAPFolder *_selectedFolder;
166
167 unichar _folderSeparator;
168 int _tag;
169 }
170
171 /*!
172 @method folderForName:mode:prefetch:
173 @discussion This method is used to get the folder with
174 the specified name and mode.
175 @param theName The name of the folder to obtain.
176 @param theMode The mode to use. The value is one of the PantomimeFolderMode enum.
177 @param aBOOL YES if prefetch should be done on the folder, NO otherwise.
178 @result A CWIMAPFolder instance.
179 */
180 - (CWIMAPFolder *) folderForName: (NSString *) theName
181 mode: (PantomimeFolderMode) theMode
182 prefetch: (BOOL) aBOOL;
183
184 /*!
185 @method folderForName:select:
186 @discussion This method is used to obtain the folder with
187 the specified name. If <i>aBOOL</i> is YES,
188 the folder will be selected. Otherwise, a non-selected
189 folder will be returned which is used to proceed with
190 an append operation. Note that when <i>aBOOL</i> is
191 equal to NO, the returned folder is NOT part of the
192 list of opened folders.
193 @param theName The name of the folder to obtain.
194 @param aBOOL YES to select the folder, NO otherwise.
195 @result A CWIMAPFolder instance.
196 */
197 - (CWIMAPFolder *) folderForName: (NSString *) theName
198 select: (BOOL) aBOOL;
199
200 /*!
201 @method nextTag
202 @discussion This method is used to obtain the next IMAP tag
203 that will be sent to the IMAP server. Normally
204 you shouldn't call this method directly.
205 @result The tag as a NSData instance.
206 */
207 - (NSData *) nextTag;
208
209 /*!
210 @method lastTag
211 @discussion This method is used to obtain the last IMAP tag
212 sent to the IMAP server.
213 @result The tag as a NSData instance.
214 */
215 - (NSData *) lastTag;
216
217 /*!
218 @method subscribeToFolderWithName:
219 @discussion This method is used to subscribe to the specified folder.
220 The method will post a PantomimeFolderSubscribeCompleted notification
221 (and call -folderSubscribeCompleted: on the delegate, if any) if
222 it succeeded. If not, it will post a PantomimeFolderSubscribeFailed
223 notification (and call -folderSubscribeFailed: on the delegate, if any)
224 @param theName The name of the folder to subscribe to.
225 */
226 - (void) subscribeToFolderWithName: (NSString *) theName;
227
228 /*!
229 @method unsubscribeToFolderWithName:
230 @discussion This method is used to unsubscribe to the specified folder.
231 The method will post a PantomimeFolderUnsubscribeCompleted notification
232 (and call -folderUnsubscribeCompleted: on the delegate, if any) if
233 it succeeded. If not, it will post a PantomimeFolderUnsubscribeFailed
234 notification (and call -folderUnsubscribeFailed: on the delegate, if any)
235 @param theName The name of the folder to subscribe to.
236 */
237 - (void) unsubscribeToFolderWithName: (NSString *) theName;
238
239 /*!
240 @method folderStatus:
241 @discussion This method is used to obtain the status of the specified
242 folder names in <i>theArray</i>. It is fully asynchronous.
243 The first time it is invoked, it'll perform its work asynchronously
244 and post a PantomimeFolderStatusCompleted notification (and call
245 -folderStatusCompleted on the delegate, if any) if succeeded. If not,
246 it will post a PantomimeFolderStatusFailed notification (and call
247 -folderStatusFailed: on the delegate, if any). Further calls
248 of this method on the same set of folders will immediately return
249 the status information.
250 @param theArray The array of folder names.
251 @result A NSDictionary instance for which the keys are the folder names (NSString instance)
252 and the values are CWFolderInformation instance if the information was
253 loaded, nil otherwise.
254 */
255 - (NSDictionary *) folderStatus: (NSArray *) theArray;
256
257 /*!
258 @method sendCommand:info:arguments: ...
259 @discussion This method is used to send commands to the IMAP server.
260 Normally, you should not call this method directly.
261 @param theCommand The IMAP command to send.
262 @param theInfo The addition info to pass.
263 @param theFormat The format defining the variable arguments list.
264 */
265 - (void) sendCommand: (IMAPCommand) theCommand info: (NSDictionary *) theInfo arguments: (NSString *) theFormat, ...;
266
267 @end
268
269 #endif // _Pantomime_H_IMAPStore