2 Copyright (C) 2000-2004 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 __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 Responses are send to all registered response receivers.
37 TODO: explain notification system.
40 @class NSMutableArray, NSString, NSNumber, NSDictionary, NSArray, NSURL;
41 @class EOGlobalID, EOQualifier;
43 @class NGImap4ResponseParser, NGImap4Client, NGImap4ResponseNormalizer;
46 UnConnected_NGImap4State = 1,
47 NonAuthenticated_NGImap4State,
48 Authenticated_NGImap4State,
49 Selected_NGImap4State,
52 @interface NGImap4Client : NSObject
54 id<NGActiveSocket> socket;
55 id<NGExtendedTextStream> text;
56 id<NGSocketAddress> address;
57 NGImap4ResponseParser *parser;
58 NGImap4ResponseNormalizer *normer;
59 NSMutableArray *responseReceiver;
65 NSString *selectedFolder;
72 NGImap4Context *context; /* not retained, used to store exceptions */
73 EOGlobalID *serverGID;
76 + (id)clientWithURL:(NSURL *)_url;
77 + (id)clientWithAddress:(id<NGSocketAddress>)_address;
78 + (id)clientWithHost:(id)_host;
80 - (id)initWithURL:(NSURL *)_url;
81 - (id)initWithHost:(id)_host;
82 - (id)initWithAddress:(id<NGSocketAddress>)_address;
86 - (BOOL)isEqualToClient:(NGImap4Client *)_obj;
90 - (id<NGActiveSocket>)socket;
91 - (id<NGSocketAddress>)address;
92 - (NSString *)delimiter;
93 - (EOGlobalID *)serverGlobalID;
97 - (void)registerForResponseNotification:(id<NGImap4ResponseReceiver>)_obj;
98 - (void)removeFromResponseNotification:(id<NGImap4ResponseReceiver>)_obj;
102 - (NSDictionary *)openConnection;
103 - (void)closeConnection;
104 - (NSNumber *)isConnected;
109 - (NSDictionary *)login:(NSString *)_login password:(NSString *)_passwd;
110 - (NSDictionary *)logout;
111 - (NSDictionary *)noop;
113 - (NSDictionary *)capability;
114 - (NSDictionary *)list:(NSString *)_folder pattern:(NSString *)_pattern;
115 - (NSDictionary *)lsub:(NSString *)_folder pattern:(NSString *)_pattern;
116 - (NSDictionary *)select:(NSString *)_folder;
117 - (NSDictionary *)status:(NSString *)_folder flags:(NSArray *)_flags;
118 - (NSDictionary *)rename:(NSString *)_folder to:(NSString *)_newName;
119 - (NSDictionary *)delete:(NSString *)_folder;
120 - (NSDictionary *)create:(NSString *)_name;
121 - (NSDictionary *)subscribe:(NSString *)_name;
122 - (NSDictionary *)unsubscribe:(NSString *)_name;
123 - (NSDictionary *)expunge;
125 - (NSDictionary *)sort:(NSArray *)_sortOrderings
126 qualifier:(EOQualifier *)_qual;
127 - (NSDictionary *)fetchUids:(NSArray *)_uids parts:(NSArray *)_parts;
128 - (NSDictionary *)fetchUid:(unsigned)_uid parts:(NSArray *)_parts;
129 - (NSDictionary *)fetchFrom:(unsigned)_from to:(unsigned)_to
130 parts:(NSArray *)_parts;
131 - (NSDictionary *)storeUid:(unsigned)_uid add:(NSNumber *)_add
132 flags:(NSArray *)_flags;
133 - (NSDictionary *)storeFrom:(unsigned)_from to:(unsigned)_to
134 add:(NSNumber *)_add flags:(NSArray *)_flags;
135 - (NSDictionary *)copyUid:(unsigned)_uid toFolder:(NSString *)_folder;
136 - (NSDictionary *)copyFrom:(unsigned)_from to:(unsigned)_to
137 toFolder:(NSString *)_folder;
138 - (NSDictionary *)append:(NSData *)_message toFolder:(NSString *)_folder
139 withFlags:(NSArray *)_flags;
140 - (NSDictionary *)threadBySubject:(BOOL)_bySubject
141 charset:(NSString *)_charSet;
142 - (NSDictionary *)getQuotaRoot:(NSString *)_folder;
144 - (NSDictionary *)searchWithQualifier:(EOQualifier *)_qualifier;
146 - (void)setContext:(NGImap4Context *)_ctx;
147 - (NGImap4Context *)context;
151 #endif /* __SOPE_NGImap4_NGImap4Client_H__ */