| 1 | /* |
| 2 | ** CWIMAPFolder.h |
| 3 | ** |
| 4 | ** Copyright (c) 2001-2006 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_CWIMAPFolder |
| 23 | #define _Pantomime_H_CWIMAPFolder |
| 24 | |
| 25 | #include <Pantomime/CWFolder.h> |
| 26 | |
| 27 | #import <Foundation/NSArray.h> |
| 28 | #import <Foundation/NSData.h> |
| 29 | #import <Foundation/NSString.h> |
| 30 | #import <Foundation/NSCalendarDate.h> |
| 31 | |
| 32 | #include <Pantomime/CWConstants.h> |
| 33 | |
| 34 | /*! |
| 35 | @const PantomimeMessagesCopyCompleted |
| 36 | @discussion This notification is posted when CWIMAPFolder: -copyMessages: |
| 37 | toFolder: has successfully completed. -messagesCopyCompleted: |
| 38 | is also called on the delegate, if any. |
| 39 | */ |
| 40 | extern NSString* PantomimeMessagesCopyCompleted; |
| 41 | |
| 42 | /*! |
| 43 | @const PantomimeMessagesCopyFailed |
| 44 | @discussion This notification is posted when CWIMAPFolder: -copyMessages: |
| 45 | toFolder: has failed to complete. -messagesCopyFailed: |
| 46 | is also called on the delegate, if any. |
| 47 | */ |
| 48 | extern NSString* PantomimeMessagesCopyFailed; |
| 49 | |
| 50 | /*! |
| 51 | @const PantomimeMessageStoreCompleted |
| 52 | @discussion This notification is posted when CWIMAPFolder: -setFlags: |
| 53 | messages: has successfully completed. -messageStoreCompleted: |
| 54 | is also called on the delegate, if any. |
| 55 | */ |
| 56 | extern NSString* PantomimeMessageStoreCompleted; |
| 57 | |
| 58 | /*! |
| 59 | @const PantomimeMessageStoreFailed |
| 60 | @discussion This notification is posted when CWIMAPFolder: -setFlags: |
| 61 | messages: has failed to completed. -messageStoreFailed: |
| 62 | is also called on the delegate, if any. |
| 63 | */ |
| 64 | extern NSString* PantomimeMessageStoreFailed; |
| 65 | |
| 66 | |
| 67 | /*! |
| 68 | @class CWIMAPFolder |
| 69 | @discussion This class, which extends the CWFolder class, is used to |
| 70 | implement IMAP-specific features such as server-side |
| 71 | operations for copying messages between mailboxes. |
| 72 | */ |
| 73 | @interface CWIMAPFolder : CWFolder |
| 74 | { |
| 75 | @private |
| 76 | unsigned int _uid_validity; |
| 77 | BOOL _selected; |
| 78 | } |
| 79 | |
| 80 | /*! |
| 81 | @method initWithName: mode: |
| 82 | @discussion This method is used to initialize the receiver |
| 83 | with <i>theName</i> using <i>theMode</i>. Normally, |
| 84 | you should not invoke this method directly. |
| 85 | You must rather use one of CWIMAPStore's folderForName: ... |
| 86 | method. |
| 87 | @param theName The name of the folder. |
| 88 | @param theMode The mode to use. Accepted values are part of the |
| 89 | PantomimeFolderMode enum. |
| 90 | @result An CWIMAPFolder instance, nil on error. |
| 91 | */ |
| 92 | - (id) initWithName: (NSString *) theName |
| 93 | mode: (PantomimeFolderMode) theMode; |
| 94 | |
| 95 | /*! |
| 96 | @method appendMessageFromRawSource:flags:internalDate |
| 97 | @discussion This method is used to append a message from its raw source |
| 98 | representation (RFC2822 compliant) to the underlying store. It differs from |
| 99 | -appendMessageFromRawSource:flags: in that this method supplies the |
| 100 | given date to the server to use as the INTERNALDATE. Not supplying this |
| 101 | date will cause some servers and clients to report the date of the message |
| 102 | as the current date and time, rather than that specified in the Received |
| 103 | header. |
| 104 | @param theData The raw representation of the message to append. |
| 105 | @param theFlags The flags of the message, nil if no flags need to be kept. |
| 106 | @param theDate The INTERNALDATE of the message, or nil to use the current date. |
| 107 | */ |
| 108 | - (void) appendMessageFromRawSource: (NSData *) theData |
| 109 | flags:(CWFlags *) theFlags |
| 110 | internalDate: (NSCalendarDate *) theDate; |
| 111 | |
| 112 | /*! |
| 113 | @method copyMessages: toFolder: |
| 114 | @discussion This method copies the messages in <i>theMessages</i> array from |
| 115 | the receiver to the destination folder's name, <i>theFolder</i>. |
| 116 | On success, this method posts a PantomimeMessagesCopyCompleted notification |
| 117 | (and calls -messagesCopyCompleted: on the delegate, if any). On failure, |
| 118 | it posts a PantomimeMessagesCopyFailed notification (and calls |
| 119 | -messagesCopyFailed: on the delegate, if any). This method is |
| 120 | fully asynchronous. |
| 121 | @param theMessages The messages to copy. |
| 122 | @param theFolder The name of the target folder. The name must include |
| 123 | hierarchy separators if the target folder is a subfolder. |
| 124 | */ |
| 125 | - (void) copyMessages: (NSArray *) theMessages |
| 126 | toFolder: (NSString *) theFolder; |
| 127 | |
| 128 | /*! |
| 129 | @method prefetch |
| 130 | @discussion This method is used to cache part of the message headers |
| 131 | from the IMAP server. On completion, it posts the PantomimeFolderPrefetchCompleted |
| 132 | notification (and calls -folderPrefetchCompleted: on the delegate, if any). |
| 133 | This method is fully asynchronous. |
| 134 | */ |
| 135 | - (void) prefetch; |
| 136 | |
| 137 | /*! |
| 138 | @method UIDValidity |
| 139 | @discussion This method is used to obtain the UID validity of an IMAP folder. |
| 140 | Refer to "2.3.1.1. Unique Identifier (UID) Message Attribute" of |
| 141 | RFC 3501 for a detailed description of this parameter. |
| 142 | @result The UID validity of the folder. |
| 143 | */ |
| 144 | - (unsigned int) UIDValidity; |
| 145 | |
| 146 | /*! |
| 147 | @method setUIDValidity: |
| 148 | @discussion This method is used to set the UID validity of the receiver. |
| 149 | If the receiver has a cache (instance of CWIMAPCacheManager) and |
| 150 | the UID validity of its cache differs from <i>theUIDValidity</i>, |
| 151 | all cache entries are invalidated. |
| 152 | @param theUIDValidity The UID validity value. |
| 153 | */ |
| 154 | - (void) setUIDValidity: (unsigned int) theUIDValidity; |
| 155 | |
| 156 | /*! |
| 157 | @method selected |
| 158 | @discussion This method is used to verify if the folder is in |
| 159 | a selected state. |
| 160 | @result YES if it is in a selected state, NO otherwise. |
| 161 | */ |
| 162 | - (BOOL) selected; |
| 163 | |
| 164 | /*! |
| 165 | @method setSelected: |
| 166 | @discussion This method is used to specify if the folder is in |
| 167 | a selected state or not. You should never call |
| 168 | this method directly. Instead, call IMAPStore: |
| 169 | -folderForName: select:. |
| 170 | @param theBOOL YES if it is in a selected state, NO otherwise. |
| 171 | */ |
| 172 | - (void) setSelected: (BOOL) theBOOL; |
| 173 | |
| 174 | @end |
| 175 | |
| 176 | #endif // _Pantomime_H_CWIMAPFolder |