Debian Codegraph @

Framework/Pantomime/CWStore.h

raw symbols SCIP
1 /*
2 ** CWStore.h
3 **
4 ** Copyright (c) 2001-2006 Ludovic Marcotte
5 ** Copyright (c) 2018 Riccardo Mottola
6 **
7 ** Author: Ludovic Marcotte <[email protected]>
8 ** Riccardo Mottola <[email protected]>
9 **
10 ** This library is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU Lesser General Public
12 ** License as published by the Free Software Foundation; either
13 ** version 2.1 of the License, or (at your option) any later version.
14 **
15 ** This library is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** Lesser General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #ifndef _Pantomime_H_CWStore
25 #define _Pantomime_H_CWStore
26
27 #import <Foundation/NSEnumerator.h>
28 #import <Foundation/NSString.h>
29
30 #include <Pantomime/CWConstants.h>
31
32 /*!
33 @const PantomimeFolderCreateCompleted
34 */
35 extern NSString* PantomimeFolderCreateCompleted;
36
37 /*!
38 @const PantomimeFolderCreateFailed
39 */
40 extern NSString* PantomimeFolderCreateFailed;
41
42 /*!
43 @const PantomimeFolderDeleteCompleted
44 */
45 extern NSString* PantomimeFolderDeleteCompleted;
46
47 /*!
48 @const PantomimeFolderDeleteFailed
49 */
50 extern NSString* PantomimeFolderDeleteFailed;
51
52 /*!
53 @const PantomimeFolderRenameCompleted
54 */
55 extern NSString* PantomimeFolderRenameCompleted;
56
57 /*!
58 @const PantomimeFolderRenameFailed
59 */
60 extern NSString* PantomimeFolderRenameFailed;
61
62
63 @class CWFolder;
64 @class CWURLName;
65
66 /*!
67 @protocol CWStore
68 @discussion This protocol defines a basic set of methods that classes implementing
69 the protocol must implement in order to offer all the required
70 functionalities of a message store. CWIMAPStore, CWLocalStore and CWPOP3Store
71 are classes that currently implement this protocol.
72 */
73 @protocol CWStore
74
75 /*!
76 @method initWithURL:
77 @discussion This method is used to initialize a Store instance using
78 the specified URL. <i>theURL</i>.
79 @param theURL The URL, as a CWURLName instance.
80 @result A CWStore subclass instance, nil on error.
81 */
82 - (id) initWithURL: (CWURLName *) theURL;
83
84 /*!
85 @method defaultFolder
86 @discussion This method is used to obtain the default folder
87 of the receiver. For example, CWPOP3Store will always
88 return the "INBOX" folder as no other folder is
89 accessible in POP3.
90 @result A CWFolder subclass instance.
91 */
92 - (id) defaultFolder;
93
94 /*!
95 @method folderForName:
96 @discussion This method is used to obtain a CWFolder instance
97 with the specifed name.
98 @param theName The name of the folder to obtain.
99 @result A CWFolder subclass instance.
100 */
101 - (id) folderForName: (NSString *) theName;
102
103 /*!
104 @method folderForURL:
105 @discussion This method is used to obtain a Folder instance
106 with the specifed URL. <i>theURL</i> must be in form which
107 is understood by the CWURLName class.
108 @param theURL The URL, as a NSString instance.
109 @result A CWFolder subclass instance.
110 */
111 - (id) folderForURL: (NSString *) theURL;
112
113 /*!
114 @method folderEnumerator
115 @discussion This method is used to get the list of all available
116 folders on the receiver. The name of the folders
117 are returned, not actual CWFolder subclass instances.
118 @result The list of folder names.
119 */
120 - (NSEnumerator *) folderEnumerator;
121
122 /*!
123 @method subscribedFolderEnumerator
124 @discussion This method is used to get the list of subscribed
125 folders on the receiver. The name of the folders
126 are returned, not actual CWFolder subclass instances.
127 This generally returns a subset of the list
128 returned by -folderEnumerator.
129 @result The list of folder names.
130 */
131 - (NSEnumerator *) subscribedFolderEnumerator;
132
133 /*!
134 @method openFoldersEnumerator
135 @discussion This method is used to obtain all the CWFolder subclass
136 instance which are in the open state in the receiver.
137 @result The list of open folders.
138 */
139 - (NSEnumerator *) openFoldersEnumerator;
140
141 /*!
142 @method removeFolderFromOpenFolders:
143 @discussion This method is used to remove the specified folder
144 from the list of open folders in the receiver.
145 Normally, you should never invoke this method directly.
146 @param theFolder The CWFolder subclass instance to remove from the
147 list of open folders.
148 */
149 - (void) removeFolderFromOpenFolders: (CWFolder *) theFolder;
150
151 /*!
152 @method folderForNameIsOpen:
153 @discussion This method is used to verify if the folder
154 with the specified name is in an open state
155 in the receiver.
156 @result YES if it is in an open state, NO otherwise.
157 */
158 - (BOOL) folderForNameIsOpen: (NSString *) theName;
159
160 /*!
161 @method folderTypeForFolderName:
162 @discussion This method is used to obtain the folder type
163 of the specified folder name. The returned value
164 is part of the folderTypeForFolderName enum.
165 @param theName The name of the folder.
166 @result The type of the folder.
167 */
168 - (PantomimeFolderType) folderTypeForFolderName: (NSString *) theName;
169
170 /*!
171 @method folderSeparator
172 @discussion This method is used to obtain the folder separator
173 of the receiver. The separator hierarchically
174 separates folders. Returned values are generatlly
175 either '/' or '.'.
176 @result The folder separator, 0 if none was set. For example,
177 in CWIMAPStore, this method will return NULL if -folderEnumerator
178 or -subscribedFolderEnumerator was not invoked before
179 calling this method.
180 */
181 - (unichar) folderSeparator;
182
183 /*!
184 @method close
185 @discussion This method is used to close the receiver.
186 Classes implementing the CWStore protocol will
187 also release all resources, like open folders,
188 CWConnection instances, etc.
189 */
190 - (void) close;
191
192 /*!
193 @method createFolderWithName:type:contents:
194 @discussion This method is used to create a new folder
195 with the specified name, type and contents.
196 On success, it posts the PantomimeFolderCreateCompleted notification
197 and calls -folderCreateCompleted: on the delegate.
198 On failure, it posts the PantomimeFolderCreateFailed notification
199 and calls -folderCreateFailed: on the delegate.
200 @param theName The name of the folder to create. It must be a full path.
201 @param theType The folder type. Accepted values are part of the PantomimeFolderFormat enum.
202 @param theContents The initial content of the folder. It must be in mbox format.
203 */
204 - (void) createFolderWithName: (NSString *) theName
205 type: (PantomimeFolderFormat) theType
206 contents: (NSData *) theContents;
207
208 /*!
209 @method deleteFolderWithName:
210 @discussion This method is used to delete the folder
211 specified by <i>theName</i>. On success, it posts the
212 PantomimeFolderDeleteCompleted notification. On error, it posts
213 the PantomimeFolderDeleteFailed notification.
214 @param theName The name of the folder to delete.
215 */
216 - (void) deleteFolderWithName: (NSString *) theName;
217
218 /*!
219 @method renameFolderWithName:toName:
220 @discussion This method is used to rename a folder. On success, this method
221 posts a PantomimeFolderRenameCompleted notification. On error,
222 it posts a PantomimeFolderRenameFailed notification.
223 @param theName The name of the folder to rename.
224 @param theNewName The name of the folder to rename it to.
225 */
226 - (void) renameFolderWithName: (NSString *) theName
227 toName: (NSString *) theNewName;
228 @end
229
230 #endif // _Pantomime_H_CWStore