/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGNet_NGActiveSocket_H__
#define __NGNet_NGActiveSocket_H__
@class NSData, NSFileHandle;
/*
- Represents an active STREAM socket based on the standard Unix sockets library.
+ Represents an active STREAM socket based on the standard Unix sockets
+ library.
An active socket can be either a socket gained by calling accept with an
- passive socket or by explicitly connecting one to an address (a client socket).
+ passive socket or by explicitly connecting one to an address (a client
+ socket).
Therefore an active socket has two addresses, the local and the remote one.
There are three methods to perform a close, this is rooted in the fact that
/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGNet_NGSocketProtocols_H__
#define __NGNet_NGSocketProtocols_H__
/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGStreams_NGStream_H__
#define __NGStreams_NGStream_H__
/* methods which read/write exactly _len bytes */
+// TODO: should return exception? (would change the API significantly)
- (BOOL)safeReadBytes:(void *)_buf count:(unsigned)_len;
- (BOOL)safeWriteBytes:(const void *)_buf count:(unsigned)_len;
/*
- Copyright (C) 2000-2003 SKYRIX Software AG
+ Copyright (C) 2000-2004 SKYRIX Software AG
- This file is part of OGo
+ This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
-// $Id$
#ifndef __NGStreams_NGTextStream_H__
#define __NGStreams_NGTextStream_H__
- (void)setLastException:(NSException *)_exception;
- (void)resetLastException;
-// NGExtendedTextInputStream
+/* NGExtendedTextInputStream */
- (NSString *)readLineAsString; // inefficient
- (unsigned)readCharacters:(unichar *)_chars count:(unsigned)_count;
+2004-11-19 Helge Hess <helge.hess@skyrix.com>
+
+ * NGImap4: minor code cleanups (v4.5.200)
+
2004-11-16 Helge Hess <helge.hess@skyrix.com>
* NGImap4: minor code cleanups in NGSieveClient (v4.5.199)
+2004-11-19 Helge Hess <helge.hess@skyrix.com>
+
+ * NGSieveClient.m, NGImap4Client.m: minor code cleanups
+
2004-11-16 Helge Hess <helge.hess@skyrix.com>
* NGSieveClient.m: some code cleanups, needs fixes for UTF-8 scripts
[self sendCommand:_command withTag:YES logText:_command];
}
-static inline NSArray *_flags2ImapFlags(NGImap4Client *self, NSArray *_flags) {
+- (NSArray *)_flags2ImapFlags:(NSArray *)_flags {
+ /* adds backslashes in front of the flags */
NSEnumerator *enumerator;
NSArray *result;
id obj;
id *objs;
unsigned cnt;
-
+
objs = calloc([_flags count] + 2, sizeof(id));
cnt = 0;
enumerator = [_flags objectEnumerator];
cnt++;
}
result = [NSArray arrayWithObjects:objs count:cnt];
- if (objs) free(objs);
+ if (objs != NULL) free(objs);
return result;
}
+static inline NSArray *_flags2ImapFlags(NGImap4Client *self, NSArray *_flags) {
+ return [self _flags2ImapFlags:_flags];
+}
- (NSString *)_folder2ImapFolder:(NSString *)_folder {
NSArray *array;
@end
-/*"
-** An implementation of an Imap4 client
-**
-** A folder name always looks like an absolute filename (/inbox/doof)
-**
-"*/
+/*
+ An implementation of an Imap4 client
+
+ A folder name always looks like an absolute filename (/inbox/blah)
+
+ NOTE: Sieve is just the filtering language ...
+
+ This should be ACAP?
+ http://asg.web.cmu.edu/rfc/rfc2244.html
+
+ ---snip---
+"IMPLEMENTATION" "Cyrus timsieved v2.1.15-IPv6-Debian-2.1.15-0woody.1.0"
+"SASL" "PLAIN"
+"SIEVE" "fileinto reject envelope vacation imapflags notify subaddress relational regex"
+"STARTTLS"
+OK
+ ---snap---
+*/
@implementation NGSieveClient
-static int defaultSievePort = 143;
-static NSNumber *YesNumber = nil;
-static NSNumber *NoNumber = nil;
+static int defaultSievePort = 2000;
+static NSNumber *YesNumber = nil;
+static NSNumber *NoNumber = nil;
static BOOL ProfileImapEnabled = NO;
static BOOL LOG_PASSWORD = NO;
static BOOL debugImap4 = NO;
- (id)initWithHost:(id)_host {
NGInternetSocketAddress *a;
+
a = [NGInternetSocketAddress addressWithPort:defaultSievePort onHost:_host];
return [self initWithAddress:a];
}
-/**"
- ** designated initializer
-"**/
-
-- (id)initWithAddress:(id<NGSocketAddress>)_address {
+- (id)initWithAddress:(id<NGSocketAddress>)_address { // di
if ((self = [super init])) {
self->address = [_address retain];
self->debug = debugImap4;
/* connection */
-/*"
-** Opens a connection to given Host.
-"*/
+/* Opens a connection to given Host. */
- (NSDictionary *)openConnection {
struct timeval tv;
[self->parser release]; self->parser = nil;
}
-/*"
-** login with plaintext password authenticating
-"*/
+/* login with plaintext password authenticating */
- (NSDictionary *)login:(NSString *)_login password:(NSString *)_passwd {
if ((_login == nil) || (_passwd == nil))
return nil;
-
+
[self->login release]; self->login = nil;
[self->password release]; self->password = nil;
logLen = [self->login cStringLength];
- bufLen = (logLen*2) + [self->password cStringLength] +2;
-
+ bufLen = (logLen * 2) + [self->password cStringLength] +2;
+
buf = calloc(sizeof(char), bufLen);
sprintf(buf, "%s %s %s",
return [self normalizeResponse:map];
}
-/*
- logout from the connected host and close the connection
-*/
+/* logout from the connected host and close the connection */
- (NSDictionary *)logout {
NGHashMap *map;
- (void)sendCommand:(NSString *)_command logText:(NSString *)_txt {
// TODO: should accept 'NSData' commands
NSString *command = nil;
-
+
command = _command;
-
+
if (self->debug)
fprintf(stderr, "C: %s\n", [_txt cString]);
MAJOR_VERSION:=4
MINOR_VERSION:=5
-SUBMINOR_VERSION:=199
+SUBMINOR_VERSION:=200
# v4.2.149 requires libNGStreams v4.2.34