From: helge Date: Sun, 28 Nov 2004 18:07:40 +0000 (+0000) Subject: merged some Sieve stuff X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18e80132cc2eb90d2e611b7e1ebdc2e0b92ece29;p=sope merged some Sieve stuff git-svn-id: http://svn.opengroupware.org/SOPE/trunk@421 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-mime/NGImap4/NGSieveClient.m b/sope-mime/NGImap4/NGSieveClient.m index d3478d61..5d0bc0e0 100644 --- a/sope-mime/NGImap4/NGSieveClient.m +++ b/sope-mime/NGImap4/NGSieveClient.m @@ -240,14 +240,15 @@ static BOOL debugImap4 = NO; } - (NSNumber *)isConnected { - // TODO: why does this return a number?! - /* - Check whether stream is already open (could be closed because - server-timeout + /* + Check whether stream is already open (could be closed due to a server + timeout) */ - return [NSNumber numberWithBool: - (self->socket == nil) - ? NO : [(NGActiveSocket *)self->socket isAlive]]; + // TODO: why does that return an object? + if (self->socket == nil) + return [NSNumber numberWithBool:NO]; + + return [NSNumber numberWithBool:[(NGActiveSocket *)self->socket isAlive]]; } - (void)closeConnection { @@ -321,7 +322,13 @@ static BOOL debugImap4 = NO; map = [self processCommand:s logText:@"AUTHENTICATE \"PLAIN\" {%d+}\r\nLOGIN:PASSWORD\r\n"]; } - return map ? [self normalizeResponse:map] : nil; + + if (map == nil) { + [self logWithFormat:@"ERROR: got no result from command."]; + return nil; + } + + return [self normalizeResponse:map]; } /* logout from the connected host and close the connection */ @@ -489,16 +496,15 @@ static BOOL debugImap4 = NO; } -/* - Filter for all responses +- (NSMutableDictionary *)normalizeResponse:(NGHashMap *)_map { + /* + Filter for all responses result : NSNumber (response result) exists : NSNumber (number of exists mails in selectet folder recent : NSNumber (number of recent mails in selectet folder expunge : NSArray (message sequence number of expunged mails - in selectet folder) -*/ - -- (NSMutableDictionary *)normalizeResponse:(NGHashMap *)_map { + in selectet folder) + */ id keys[3], values[3]; NSParameterAssert(_map != nil); @@ -509,7 +515,6 @@ static BOOL debugImap4 = NO; forKeys:keys count:2]; } - - (NSDictionary *)normalizeOpenConnectionResponse:(NGHashMap *)_map { /* filter for open connection */ NSMutableDictionary *result;