2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __SOPE_NGImap4_NGImap4Client_H__
23 #define __SOPE_NGImap4_NGImap4Client_H__
25 #import <Foundation/NSObject.h>
26 #include <NGStreams/NGStreams.h>
27 #include <NGStreams/NGSocketProtocols.h>
28 #include <NGImap4/NGImap4Support.h>
33 An IMAP4 client object. This object is a thin wrapper around the TCP/IP
34 socket (id<NGActiveSocket> object) connecting to the IMAP4 server.
36 While it is pretty near to the IMAP4 raw protocol, it already does some
37 normalization of responses. We might want to have something which is even
38 lower level in the future.
40 Responses are send to all registered response receivers.
41 TODO: explain notification system.
44 @class NSMutableArray, NSString, NSNumber, NSDictionary, NSArray, NSURL;
45 @class EOGlobalID, EOQualifier;
47 @class NGImap4ResponseParser, NGImap4Client, NGImap4ResponseNormalizer;
50 UnConnected_NGImap4State = 1,
51 NonAuthenticated_NGImap4State,
52 Authenticated_NGImap4State,
53 Selected_NGImap4State,
56 @interface NGImap4Client : NSObject
58 id<NGActiveSocket> socket;
59 id<NGExtendedTextStream> text;
60 id<NGSocketAddress> address;
61 NGImap4ResponseParser *parser;
62 NGImap4ResponseNormalizer *normer;
63 NSMutableArray *responseReceiver;
69 NSString *selectedFolder;
76 NGImap4Context *context; /* not retained, used to store exceptions */
77 EOGlobalID *serverGID;
80 + (id)clientWithURL:(NSURL *)_url;
81 + (id)clientWithAddress:(id<NGSocketAddress>)_address;
82 + (id)clientWithHost:(id)_host;
84 - (id)initWithURL:(NSURL *)_url;
85 - (id)initWithHost:(id)_host;
86 - (id)initWithAddress:(id<NGSocketAddress>)_address;
90 - (BOOL)isEqualToClient:(NGImap4Client *)_obj;
94 - (id<NGActiveSocket>)socket;
95 - (id<NGSocketAddress>)address;
96 - (NSString *)delimiter;
97 - (EOGlobalID *)serverGlobalID;
99 - (NSString *)selectedFolderName;
103 - (void)registerForResponseNotification:(id<NGImap4ResponseReceiver>)_obj;
104 - (void)removeFromResponseNotification:(id<NGImap4ResponseReceiver>)_obj;
108 - (NSDictionary *)openConnection;
109 - (void)closeConnection;
110 - (NSNumber *)isConnected;
115 - (NSDictionary *)login:(NSString *)_login password:(NSString *)_passwd;
116 - (NSDictionary *)logout;
117 - (NSDictionary *)noop;
119 - (NSDictionary *)capability;
120 - (NSDictionary *)list:(NSString *)_folder pattern:(NSString *)_pattern;
121 - (NSDictionary *)lsub:(NSString *)_folder pattern:(NSString *)_pattern;
122 - (NSDictionary *)select:(NSString *)_folder;
123 - (NSDictionary *)status:(NSString *)_folder flags:(NSArray *)_flags;
124 - (NSDictionary *)rename:(NSString *)_folder to:(NSString *)_newName;
125 - (NSDictionary *)delete:(NSString *)_folder;
126 - (NSDictionary *)create:(NSString *)_name;
127 - (NSDictionary *)subscribe:(NSString *)_name;
128 - (NSDictionary *)unsubscribe:(NSString *)_name;
129 - (NSDictionary *)expunge;
131 - (NSDictionary *)sort:(id)_sortOrderings qualifier:(EOQualifier *)_qual
132 encoding:(NSString *)_encoding;
133 - (NSDictionary *)fetchUids:(NSArray *)_uids parts:(NSArray *)_parts;
134 - (NSDictionary *)fetchUid:(unsigned)_uid parts:(NSArray *)_parts;
135 - (NSDictionary *)fetchFrom:(unsigned)_from to:(unsigned)_to
136 parts:(NSArray *)_parts;
137 - (NSDictionary *)storeUid:(unsigned)_uid add:(NSNumber *)_add
138 flags:(NSArray *)_flags;
139 - (NSDictionary *)storeFrom:(unsigned)_from to:(unsigned)_to
140 add:(NSNumber *)_add flags:(NSArray *)_flags;
141 - (NSDictionary *)storeFlags:(NSArray *)_flags forMSNs:(id)_msns
142 addOrRemove:(BOOL)_flag;
144 - (NSDictionary *)copyUid:(unsigned)_uid toFolder:(NSString *)_folder;
145 - (NSDictionary *)copyUids:(NSArray *)_uids toFolder:(NSString *)_folder;
146 - (NSDictionary *)copyFrom:(unsigned)_from to:(unsigned)_to
147 toFolder:(NSString *)_folder;
149 - (NSDictionary *)append:(NSData *)_message toFolder:(NSString *)_folder
150 withFlags:(NSArray *)_flags;
151 - (NSDictionary *)threadBySubject:(BOOL)_bySubject
152 charset:(NSString *)_charSet;
153 - (NSDictionary *)getQuotaRoot:(NSString *)_folder;
155 - (NSDictionary *)searchWithQualifier:(EOQualifier *)_qualifier;
159 - (NSDictionary *)getACL:(NSString *)_folder;
160 - (NSDictionary *)setACL:(NSString *)_folder rights:(NSString *)_r
161 uid:(NSString *)_uid;
162 - (NSDictionary *)deleteACL:(NSString *)_folder uid:(NSString *)_uid;
163 - (NSDictionary *)listRights:(NSString *)_folder uid:(NSString *)_uid;
164 - (NSDictionary *)myRights:(NSString *)_folder;
166 /* context accessors (DEPRECATED) */
168 - (void)setContext:(NGImap4Context *)_ctx;
169 - (NGImap4Context *)context;
173 - (NSDictionary *)primarySort:(NSString *)_sortString
174 qualifierString:(NSString *)_qualString
175 encoding:(NSString *)_encoding;
179 #endif /* __SOPE_NGImap4_NGImap4Client_H__ */