]> err.no Git - sope/blob - sope-mime/NGImap4/NGImap4Client.h
fixed samples makefile for compilation, some cleanups
[sope] / sope-mime / NGImap4 / NGImap4Client.h
1 /*
2   Copyright (C) 2000-2004 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 __SOPE_NGImap4_NGImap4Client_H__
23 #define __SOPE_NGImap4_NGImap4Client_H__
24
25 #import <Foundation/NSObject.h>
26 #include <NGStreams/NGStreams.h>
27 #include <NGStreams/NGSocketProtocols.h>
28 #include <NGImap4/NGImap4Support.h>
29
30 /*
31   NGImap4Client
32   
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.
35   
36   Responses are send to all registered response receivers.
37   TODO: explain notification system.
38 */
39
40 @class NSMutableArray, NSString, NSNumber, NSDictionary, NSArray, NSURL;
41 @class EOGlobalID, EOQualifier;
42 @class NGHashMap;
43 @class NGImap4ResponseParser, NGImap4Client, NGImap4ResponseNormalizer;
44
45 typedef enum {
46   UnConnected_NGImap4State = 1,
47   NonAuthenticated_NGImap4State,
48   Authenticated_NGImap4State,
49   Selected_NGImap4State,
50 } NGImap4State;
51
52 @interface NGImap4Client : NSObject
53 {
54   id<NGActiveSocket>        socket;
55   id<NGExtendedTextStream>  text;
56   id<NGSocketAddress>       address;
57   NGImap4ResponseParser     *parser;
58   NGImap4ResponseNormalizer *normer;
59   NSMutableArray            *responseReceiver;  
60
61   BOOL     isLogin;
62   unsigned tagId;
63
64   NSString *delimiter;
65   NSString *selectedFolder;
66   NSString *login;
67   NSString *password;
68
69   BOOL debug;
70   BOOL useSSL;
71
72   NGImap4Context *context; /* not retained, used to store exceptions */
73   EOGlobalID *serverGID;
74 }
75
76 + (id)clientWithURL:(NSURL *)_url;
77 + (id)clientWithAddress:(id<NGSocketAddress>)_address;
78 + (id)clientWithHost:(id)_host;
79
80 - (id)initWithURL:(NSURL *)_url;
81 - (id)initWithHost:(id)_host;
82 - (id)initWithAddress:(id<NGSocketAddress>)_address;
83
84 /* equality */
85
86 - (BOOL)isEqualToClient:(NGImap4Client *)_obj;
87
88 /* accessors */
89
90 - (id<NGActiveSocket>)socket;
91 - (id<NGSocketAddress>)address;
92 - (NSString *)delimiter;
93 - (EOGlobalID *)serverGlobalID;
94
95 /* notifications */
96
97 - (void)registerForResponseNotification:(id<NGImap4ResponseReceiver>)_obj;
98 - (void)removeFromResponseNotification:(id<NGImap4ResponseReceiver>)_obj;
99
100 /* connection */
101
102 - (NSDictionary *)openConnection;
103 - (void)closeConnection;
104 - (NSNumber *)isConnected;
105 - (void)reconnect;
106
107 /* commands */
108
109 - (NSDictionary *)login:(NSString *)_login password:(NSString *)_passwd;
110 - (NSDictionary *)logout;
111 - (NSDictionary *)noop;
112   
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;
124   
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;
143
144 - (NSDictionary *)searchWithQualifier:(EOQualifier *)_qualifier;
145
146 - (void)setContext:(NGImap4Context *)_ctx;
147 - (NGImap4Context *)context;
148
149 @end
150
151 #endif /* __SOPE_NGImap4_NGImap4Client_H__ */