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
23 #ifndef __NGMail_NGPop3Client_H__
24 #define __NGMail_NGPop3Client_H__
26 #import <Foundation/NSObject.h>
27 #include <NGStreams/NGStreams.h>
28 #include <NGStreams/NGSocketProtocols.h>
30 @class NSString, NSData;
31 @class NGBufferedStream;
35 NGPop3State_unconnected = 1,
36 NGPop3State_AUTHORIZATION,
37 NGPop3State_TRANSACTION,
41 @class NGPop3Response, NGPop3MessageInfo;
43 @interface NGPop3Client : NSObject
46 id<NGActiveSocket> socket;
47 NGBufferedStream *connection;
48 id<NGExtendedTextStream> text;
51 NGPop3Response *lastResponse;
52 BOOL isDebuggingEnabled;
56 - (id)initWithSocket:(id<NGActiveSocket>)_socket; // designated initializer
60 - (id<NGActiveSocket>)socket;
62 - (NGPop3Response *)lastResponse;
64 - (void)setDebuggingEnabled:(BOOL)_flag;
65 - (BOOL)isDebuggingEnabled;
69 - (BOOL)connectToHost:(id)_host;
70 - (BOOL)connectToAddress:(id<NGSocketAddress>)_address;
75 - (void)requireState:(NGPop3State)_state;
76 - (void)gotoState:(NGPop3State)_state;
80 - (NGPop3Response *)sendCommand:(NSString *)_command;
81 - (NGPop3Response *)sendCommand:(NSString *)_command argument:(NSString *)arg;
82 - (NGPop3Response *)sendCommand:(NSString *)_command intArgument:(int)_arg;
84 /* service commands */
86 - (BOOL)login:(NSString *)_user password:(NSString *)_passwd;
89 - (BOOL)statMailDropCount:(int *)_count size:(int *)_size;
90 - (NGPop3MessageInfo *)listMessage:(int)_messageNumber;
91 - (NSEnumerator *)listMessages;
92 - (NSData *)retrieveMessage:(int)_msgNumber;
93 - (BOOL)deleteMessage:(int)_msgNumber;
97 /* optional service commands */
99 - (NSData *)retrieveMessage:(int)_msgNumber bodyLineCount:(int)_numberOfLines;
100 - (NSDictionary *)uniqueIdMappings;
101 - (NSString *)uniqueIdOfMessage:(int)_msgNumber;
105 - (NSEnumerator *)messageEnumerator;
106 - (NGMimeMessage *)messageWithNumber:(int)_messageNumber;
110 #endif /* __NGMail_NGPop3Client_H__ */