]> err.no Git - sope/blob - sope-mime/NGImap4/NGImap4Connection.h
synced with latest additions and bumped framework versions
[sope] / sope-mime / NGImap4 / NGImap4Connection.h
1 /*
2   Copyright (C) 2004-2005 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21
22 #ifndef __NGImap4Connection_H__
23 #define __NGImap4Connection_H__
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   NGImap4Connection
29   
30   A cached connection to an IMAP4 server plus some cached objects. Do not
31   instantiate this object directly but rather use the NGImap4ConnectionManager.
32   
33   This API is intended to be simpler and more consistent than NGImap4Client.
34   
35   It caches:
36    - the folder hierarchy
37    - uid sets?
38    - 'myrights' permissions of mailboxes
39    ?
40 */
41
42 @class NSString, NSDate, NSArray, NSDictionary, NSURL, NSMutableDictionary;
43 @class NSException, NSData;
44 @class NGImap4Client;
45
46 @interface NGImap4Connection : NSObject
47 {
48 @public
49   NGImap4Client *client;
50   NSString      *password;
51   NSDate        *creationTime;
52   NSString      *separator;
53
54   /* hierarchy cache */
55   NSDictionary  *subfolders;
56
57   /* permission cache */
58   NSMutableDictionary *urlToRights;
59   
60   /* uids cache */
61   NSArray *cachedUIDs;
62   NSURL   *uidFolderURL;
63   id      uidSortOrdering;
64 }
65
66 - (id)initWithClient:(NGImap4Client *)_client password:(NSString *)_pwd;
67
68 /* accessors */
69
70 - (NGImap4Client *)client;
71 - (BOOL)isValidPassword:(NSString *)_pwd;
72
73 - (NSDate *)creationTime;
74
75 - (void)cacheHierarchyResults:(NSDictionary *)_hierarchy;
76 - (NSDictionary *)cachedHierarchyResults;
77 - (void)flushFolderHierarchyCache;
78
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;
82
83 - (NSString *)cachedMyRightsForURL:(NSURL *)_url;
84 - (void)cacheMyRights:(NSString *)_rights forURL:(NSURL *)_url;
85
86 - (void)flushMailCaches;
87
88 /* folder operations */
89
90 - (NSArray *)subfoldersForURL:(NSURL *)_url;
91 - (NSArray *)allFoldersForURL:(NSURL *)_url;
92
93 /* message operations */
94
95 - (NSArray *)fetchUIDsInURL:(NSURL *)_url qualifier:(id)_qualifier
96   sortOrdering:(id)_so;
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;
101
102 /* message flags */
103
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;
109
110 /* posting new data */
111
112 - (NSException *)postData:(NSData *)_data flags:(id)_f toFolderURL:(NSURL *)_u;
113
114 /* operations */
115
116 - (NSException *)expungeAtURL:(NSURL *)_url;
117
118 /* copying and moving */
119
120 - (NSException *)copyMailURL:(NSURL *)_srcurl toFolderURL:(NSURL *)_desturl;
121
122 /* managing folders */
123
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;
129
130 /* ACLs */
131
132 - (NSDictionary *)aclForMailboxAtURL:(NSURL *)_url;
133 - (NSString *)myRightsForMailboxAtURL:(NSURL *)_url;
134
135 @end
136
137 #endif /* __NGImap4Connection_H__ */