2 Copyright (C) 2004-2005 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGImap4Connection_H__
23 #define __NGImap4Connection_H__
25 #import <Foundation/NSObject.h>
30 A cached connection to an IMAP4 server plus some cached objects. Do not
31 instantiate this object directly but rather use the NGImap4ConnectionManager.
33 This API is intended to be simpler and more consistent than NGImap4Client.
36 - the folder hierarchy
38 - 'myrights' permissions of mailboxes
42 @class NSString, NSDate, NSArray, NSDictionary, NSURL, NSMutableDictionary;
43 @class NSException, NSData;
46 @interface NGImap4Connection : NSObject
49 NGImap4Client *client;
55 NSDictionary *subfolders;
57 /* permission cache */
58 NSMutableDictionary *urlToRights;
66 - (id)initWithClient:(NGImap4Client *)_client password:(NSString *)_pwd;
70 - (NGImap4Client *)client;
71 - (BOOL)isValidPassword:(NSString *)_pwd;
73 - (NSDate *)creationTime;
75 - (void)cacheHierarchyResults:(NSDictionary *)_hierarchy;
76 - (NSDictionary *)cachedHierarchyResults;
77 - (void)flushFolderHierarchyCache;
79 - (id)cachedUIDsForURL:(NSURL *)_url qualifier:(id)_q sortOrdering:(id)_so;
80 - (void)cacheUIDs:(NSArray *)_uids forURL:(NSURL *)_url
81 qualifier:(id)_q sortOrdering:(id)_so;
83 - (NSString *)cachedMyRightsForURL:(NSURL *)_url;
84 - (void)cacheMyRights:(NSString *)_rights forURL:(NSURL *)_url;
86 - (void)flushMailCaches;
88 /* folder operations */
90 - (NSArray *)subfoldersForURL:(NSURL *)_url;
91 - (NSArray *)allFoldersForURL:(NSURL *)_url;
93 /* message operations */
95 - (NSArray *)fetchUIDsInURL:(NSURL *)_url qualifier:(id)_qualifier
97 - (NSArray *)fetchUIDs:(NSArray *)_uids inURL:(NSURL *)_url
98 parts:(NSArray *)_parts;
99 - (id)fetchURL:(NSURL *)_url parts:(NSArray *)_parts;
100 - (NSData *)fetchContentOfBodyPart:(NSString *)_partId atURL:(NSURL *)_url;
104 - (NSException *)addOrRemove:(BOOL)_flag flags:(id)_f toURL:(NSURL *)_url;
105 - (NSException *)addFlags:(id)_f toURL:(NSURL *)_u;
106 - (NSException *)removeFlags:(id)_f toURL:(NSURL *)_u;
107 - (NSException *)markURLDeleted:(NSURL *)_url;
108 - (NSException *)addFlags:(id)_f toAllMessagesInURL:(NSURL *)_url;
110 /* posting new data */
112 - (NSException *)postData:(NSData *)_data flags:(id)_f toFolderURL:(NSURL *)_u;
116 - (NSException *)expungeAtURL:(NSURL *)_url;
118 /* copying and moving */
120 - (NSException *)copyMailURL:(NSURL *)_srcurl toFolderURL:(NSURL *)_desturl;
122 /* managing folders */
124 - (BOOL)doesMailboxExistAtURL:(NSURL *)_url;
125 - (id)infoForMailboxAtURL:(NSURL *)_url;
126 - (NSException *)createMailbox:(NSString *)_mailbox atURL:(NSURL *)_url;
127 - (NSException *)deleteMailboxAtURL:(NSURL *)_url;
128 - (NSException *)moveMailboxAtURL:(NSURL *)_srcurl toURL:(NSURL *)_desturl;
132 - (NSDictionary *)aclForMailboxAtURL:(NSURL *)_url;
133 - (NSString *)myRightsForMailboxAtURL:(NSURL *)_url;
137 #endif /* __NGImap4Connection_H__ */