| 1 | /* |
| 2 | ** CWIMAPCacheManager.h |
| 3 | ** |
| 4 | ** Copyright (c) 2001-2007 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_CWIMAPCacheManager |
| 25 | #define _Pantomime_H_CWIMAPCacheManager |
| 26 | |
| 27 | #import <Foundation/NSMapTable.h> |
| 28 | |
| 29 | #include <Pantomime/CWCacheManager.h> |
| 30 | |
| 31 | @class CWFolder; |
| 32 | @class CWIMAPMessage; |
| 33 | |
| 34 | /*! |
| 35 | @class CWIMAPCacheManager |
| 36 | @discussion This class provides trivial extensions to the |
| 37 | CWCacheManager superclass for CWIMAPFolder instances. |
| 38 | */ |
| 39 | @interface CWIMAPCacheManager: CWCacheManager |
| 40 | { |
| 41 | @private |
| 42 | NSMapTable *_table; |
| 43 | unsigned int _UIDValidity; |
| 44 | |
| 45 | CWFolder *_folder; |
| 46 | } |
| 47 | |
| 48 | - (id) initWithPath: (NSString *) thePath folder: (CWFolder *) theFolder; |
| 49 | |
| 50 | - (void) readAllMessages; |
| 51 | |
| 52 | - (void) readMessagesInRange: (NSRange) theRange; |
| 53 | |
| 54 | /*! |
| 55 | @method messageWithUID: |
| 56 | @discussion This method is used to obtain the CWIMAPMessage instance |
| 57 | from the receiver's cache. |
| 58 | @param theUID The UID of the message to obtain from the cache. |
| 59 | @result The instance, nil if not present in the receiver's cache. |
| 60 | */ |
| 61 | - (CWIMAPMessage *) messageWithUID: (NSUInteger) theUID; |
| 62 | |
| 63 | |
| 64 | /*! |
| 65 | @method removeMessageWithUID: |
| 66 | @discussion This method is used to remove the associated |
| 67 | message from the cache based on the supplied UID. |
| 68 | @param theUID The UID of the message to remove from the cache. |
| 69 | */ |
| 70 | - (void) removeMessageWithUID: (NSUInteger) theUID; |
| 71 | |
| 72 | /*! |
| 73 | @method UIDValidity |
| 74 | @discussion This method is used to obtain the UID validity |
| 75 | value of the receiver's cache. If it doesn't |
| 76 | match the UID validity of its associated |
| 77 | CWIMAPFolder instance, you should invalidate the cache. |
| 78 | @result The UID validity. |
| 79 | */ |
| 80 | - (unsigned int) UIDValidity; |
| 81 | |
| 82 | /*! |
| 83 | @method setUIDValidity: |
| 84 | @discussion This method is used to set the UID validity value |
| 85 | of the receiver's cache. |
| 86 | @param theUIDValidity The value to set. |
| 87 | */ |
| 88 | - (void) setUIDValidity: (unsigned int) theUIDValidity; |
| 89 | |
| 90 | /*! |
| 91 | @method writeRecord:message: |
| 92 | @discussion This method is used to write a cache record to disk. |
| 93 | @param theRecord The record to write. |
| 94 | @param theMessage The message associated to the record <i>theRecord</i>. |
| 95 | */ |
| 96 | - (void) writeRecord: (cache_record *) theRecord message: (id) theMessage; |
| 97 | @end |
| 98 | |
| 99 | #endif // _Pantomime_H_CWIMAPCacheManager |