diff --git a/SOPE/sope-patchset-r1626.diff b/SOPE/sope-patchset-r1626.diff index ef1c41a61..d2845989f 100644 --- a/SOPE/sope-patchset-r1626.diff +++ b/SOPE/sope-patchset-r1626.diff @@ -189,7 +189,16 @@ Index: sope-mime/NGImap4/NGImap4Client.h =================================================================== --- sope-mime/NGImap4/NGImap4Client.h (révision 1626) +++ sope-mime/NGImap4/NGImap4Client.h (copie de travail) -@@ -120,6 +120,7 @@ +@@ -62,6 +62,8 @@ + NGImap4ResponseNormalizer *normer; + NSMutableArray *responseReceiver; + ++ BOOL loggedIn; ++ + BOOL isLogin; + unsigned tagId; + +@@ -120,6 +122,7 @@ - (NSDictionary *)list:(NSString *)_folder pattern:(NSString *)_pattern; - (NSDictionary *)lsub:(NSString *)_folder pattern:(NSString *)_pattern; - (NSDictionary *)select:(NSString *)_folder; @@ -197,7 +206,7 @@ Index: sope-mime/NGImap4/NGImap4Client.h - (NSDictionary *)status:(NSString *)_folder flags:(NSArray *)_flags; - (NSDictionary *)rename:(NSString *)_folder to:(NSString *)_newName; - (NSDictionary *)delete:(NSString *)_folder; -@@ -138,7 +139,7 @@ +@@ -138,7 +141,7 @@ flags:(NSArray *)_flags; - (NSDictionary *)storeFrom:(unsigned)_from to:(unsigned)_to add:(NSNumber *)_add flags:(NSArray *)_flags; @@ -255,15 +264,63 @@ Index: sope-mime/NGImap4/NGImap4Client.m @end /* -@@ -508,6 +512,7 @@ +@@ -195,11 +199,14 @@ + self->debug = ImapDebugEnabled; + self->responseReceiver = [[NSMutableArray alloc] initWithCapacity:128]; + self->normer = [[NGImap4ResponseNormalizer alloc] initWithClient:self]; ++ self->loggedIn = NO; ++ self->context = nil; + } + return self; + } + + - (void)dealloc { ++ if (self->loggedIn) [self logout]; + [self removeFromConnectionRegister]; + [self->normer release]; + [self->text release]; +@@ -457,8 +464,8 @@ + - (void)reconnect { + if ([self->context lastException] != nil) + return; +- +- [self closeConnection]; ++ ++ [self closeConnection]; + self->tagId = 0; + [self openConnection]; + +@@ -481,6 +488,7 @@ + */ + NGHashMap *map; + NSString *s, *log; ++ NSDictionary *response; + + if (self->isLogin ) + return nil; +@@ -499,7 +507,11 @@ + + self->isLogin = NO; + +- return [self->normer normalizeResponse:map]; ++ response = [self->normer normalizeResponse:map]; ++ ++ self->loggedIn = [[response valueForKey:@"result"] boolValue]; ++ ++ return response; + } + + - (NSDictionary *)logout { +@@ -508,6 +520,8 @@ map = [self processCommand:@"logout"]; [self closeConnection]; + [self->selectedFolder release]; self->selectedFolder = nil; ++ self->loggedIn = NO; return [self->normer normalizeResponse:map]; } -@@ -635,6 +640,10 @@ +@@ -635,6 +649,10 @@ return [self->normer normalizeSelectResponse:[self processCommand:s]]; } @@ -274,7 +331,7 @@ Index: sope-mime/NGImap4/NGImap4Client.m - (NSDictionary *)status:(NSString *)_folder flags:(NSArray *)_flags { NSString *cmd; -@@ -820,23 +829,23 @@ +@@ -820,23 +838,23 @@ return [self->normer normalizeResponse:[self processCommand:cmd]]; } @@ -304,7 +361,7 @@ Index: sope-mime/NGImap4/NGImap4Client.m seqstr, _flag ? '+' : '-', flagstr]; return [self->normer normalizeResponse:[self processCommand:cmd]]; -@@ -967,11 +976,12 @@ +@@ -967,11 +985,12 @@ descr = @"Could not process qualifier for imap search "; descr = [descr stringByAppendingString:reason]; @@ -320,7 +377,7 @@ Index: sope-mime/NGImap4/NGImap4Client.m } - (NSString *)_searchExprForQual:(EOQualifier *)_qualifier { -@@ -1093,7 +1103,18 @@ +@@ -1093,7 +1112,18 @@ Eg: UID SORT ( DATE REVERSE SUBJECT ) UTF-8 TODO */ NSString *tmp; @@ -339,7 +396,7 @@ Index: sope-mime/NGImap4/NGImap4Client.m if ([_sortSpec isKindOfClass:[NSArray class]]) tmp = [self _generateIMAP4SortOrderings:_sortSpec]; else if ([_sortSpec isKindOfClass:[EOSortOrdering class]]) -@@ -1107,9 +1128,10 @@ +@@ -1107,9 +1137,10 @@ tmp = @"DATE"; } @@ -352,7 +409,7 @@ Index: sope-mime/NGImap4/NGImap4Client.m } - (NSDictionary *)sort:(NSArray *)_sortOrderings qualifier:(EOQualifier *)_qual -@@ -1130,7 +1152,7 @@ +@@ -1130,7 +1161,7 @@ return nil; } @@ -361,7 +418,7 @@ Index: sope-mime/NGImap4/NGImap4Client.m return [self->normer normalizeSearchResponse:[self processCommand:s]]; } -@@ -1193,6 +1215,79 @@ +@@ -1193,6 +1224,79 @@ /* Private Methods */ @@ -463,6 +520,23 @@ Index: sope-mime/NGImap4/NGImap4Connection.m if (![[result valueForKey:@"result"] boolValue]) { return [self errorForResult:result text:@"Failed to change flags of IMAP4 message"]; +@@ -911,4 +911,16 @@ + return ms; + } + ++- (id) retain ++{ ++ NSLog (@"connection (%Lx) retained: %d", self, [self retainCount] + 1); ++ return [super retain]; ++} ++ ++- (void) release ++{ ++ NSLog (@"connection (%Lx) released: %d", self, [self retainCount] - 1); ++ [super release]; ++} ++ + @end /* NGImap4Connection */ Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m =================================================================== --- sope-mime/NGImap4/NGImap4ResponseNormalizer.m (révision 1626) @@ -794,7 +868,31 @@ Index: sope-mime/NGImap4/NGImap4ConnectionManager.m if (debugOn) NSLog(@"Note: NGImap4EnableIMAP4Debug is enabled!"); if (poolingOff) NSLog(@"WARNING: IMAP4 connection pooling is disabled!"); } -@@ -91,6 +94,25 @@ +@@ -53,18 +56,17 @@ + if ((self = [super init])) { + if (!poolingOff) { + self->urlToEntry = [[NSMutableDictionary alloc] initWithCapacity:256]; ++ self->gcTimer = [[NSTimer scheduledTimerWithTimeInterval: ++ PoolScanInterval ++ target:self selector:@selector(_garbageCollect:) ++ userInfo:nil repeats:YES] retain]; + } +- +- self->gcTimer = [[NSTimer scheduledTimerWithTimeInterval: +- PoolScanInterval +- target:self selector:@selector(_garbageCollect:) +- userInfo:nil repeats:YES] retain]; + } + return self; + } + + - (void)dealloc { +- if (self->gcTimer) [self->gcTimer invalidate]; ++ [self->gcTimer invalidate]; + [self->urlToEntry release]; + [self->gcTimer release]; + [super dealloc]; +@@ -91,6 +93,25 @@ - (void)_garbageCollect:(NSTimer *)_timer { // TODO: scan for old IMAP4 channels @@ -820,6 +918,69 @@ Index: sope-mime/NGImap4/NGImap4ConnectionManager.m [self debugWithFormat:@"should collect IMAP4 channels (%d active)", [self->urlToEntry count]]; } +@@ -105,34 +126,42 @@ + NGImap4Connection *entry; + NGImap4Client *client; + ++ if (poolingOff) { ++ client = [self imap4ClientForURL:_url password:_p]; ++ entry = [[NGImap4Connection alloc] initWithClient:client ++ password:_p]; ++ return [entry autorelease]; ++ } ++ else { + /* check cache */ + +- if ((entry = [self entryForURL:_url]) != nil) { +- if ([entry isValidPassword:_p]) { ++ if ((entry = [self entryForURL:_url]) != nil) { ++ if ([entry isValidPassword:_p]) { ++ if (debugCache) ++ [self logWithFormat:@"valid password, reusing cache entry ..."]; ++ return entry; ++ } ++ ++ /* different password, password could have changed! */ + if (debugCache) +- [self logWithFormat:@"valid password, reusing cache entry ..."]; +- return entry; ++ [self logWithFormat:@"different password than cached entry: %@", _url]; ++ entry = nil; + } +- +- /* different password, password could have changed! */ +- if (debugCache) +- [self logWithFormat:@"different password than cached entry: %@", _url]; +- entry = nil; +- } +- else +- [self debugWithFormat:@"no connection cached yet for url: %@", _url]; ++ else ++ [self debugWithFormat:@"no connection cached yet for url: %@", _url]; + +- /* try to login */ ++ /* try to login */ + +- client = [entry isValidPassword:_p] +- ? [entry client] +- : [self imap4ClientForURL:_url password:_p]; ++ client = [entry isValidPassword:_p] ++ ? [entry client] ++ : [self imap4ClientForURL:_url password:_p]; ++ ++ if (client == nil) ++ return nil; + +- if (client == nil) +- return nil; +- + /* sideeffect of -imap4ClientForURL:password: is to create a cache entry */ +- return [self entryForURL:_url]; ++ return [self entryForURL:_url]; ++ } + } + + /* client object */ Index: sope-mime/NGMail/NGSmtpClient.m =================================================================== --- sope-mime/NGMail/NGSmtpClient.m (révision 1626) @@ -2664,6 +2825,41 @@ Index: sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h - (NSException *)davMoveToTargetObject:(id)_target newName:(NSString *)_name inContext:(id)_ctx; +Index: sope-appserver/NGObjWeb/WODirectAction.m +=================================================================== +--- sope-appserver/NGObjWeb/WODirectAction.m (révision 1626) ++++ sope-appserver/NGObjWeb/WODirectAction.m (copie de travail) +@@ -46,7 +46,7 @@ + } + - (id)initWithContext:(WOContext *)_ctx { + if ((self = [self initWithRequest:[_ctx request]])) { +- self->context = [_ctx retain]; ++ self->context = _ctx; + } + return self; + } +@@ -54,16 +54,16 @@ + return [self initWithRequest:nil]; + } + +-- (void)dealloc { +- [self->context release]; +- [super dealloc]; +-} ++// - (void)dealloc { ++// [self->context release]; ++// [super dealloc]; ++// } + + /* accessors */ + + - (WOContext *)context { + if (self->context == nil) +- self->context = [[[WOApplication application] context] retain]; ++ self->context = [[WOApplication application] context]; + return self->context; + } + Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m =================================================================== --- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (révision 1626)