From: helge Date: Mon, 11 Jul 2005 14:10:59 +0000 (+0000) Subject: use new API X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6f231375c1f51ee313828862f029c444ae924de;p=scalable-opengroupware.org use new API git-svn-id: http://svn.opengroupware.org/SOGo/trunk@712 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 55ab6f5a..18144025 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,5 +1,12 @@ 2005-07-11 Helge Hess + * v0.9.98 + + * use new -imap4Connection API everywhere + + * SOGoMailBaseObject.m: deprecated -mailManager method, added + -imap4Connection method + * SOGoMailBaseObject.[hm]: removed unused -imap4Client method (v0.9.97) * moved SOGoMailManager related API to NGImap4 (NGImap4Connection, diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccount.m b/SOGo/SoObjects/Mailer/SOGoMailAccount.m index 05fdcb47..aaf020bf 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccount.m +++ b/SOGo/SoObjects/Mailer/SOGoMailAccount.m @@ -59,8 +59,7 @@ static BOOL useAltNamespace = NO; a = rootFolderNames; - b = [[self mailManager] subfoldersForURL:[self imap4URL] - password:[self imap4Password]]; + b = [[self imap4Connection] subfoldersForURL:[self imap4URL]]; return [b count] > 0 ? [b arrayByAddingObjectsFromArray:a] : a; } @@ -73,8 +72,7 @@ static BOOL useAltNamespace = NO; - (NSArray *)allFolderPathes { NSArray *pathes; - pathes = [[self mailManager] allFoldersForURL:[self imap4URL] - password:[self imap4Password]]; + pathes = [[self imap4Connection] allFoldersForURL:[self imap4URL] ]; pathes = [pathes sortedArrayUsingSelector:@selector(compare:)]; return pathes; } @@ -309,8 +307,7 @@ static BOOL useAltNamespace = NO; } - (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx { - return [[self mailManager] createMailbox:_name atURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] createMailbox:_name atURL:[self imap4URL]]; } - (NSString *)shortTitle { diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h index 7003b793..924052f0 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.h @@ -55,6 +55,7 @@ /* IMAP4 */ +- (NGImap4Connection *)imap4Connection; - (NGImap4ConnectionManager *)mailManager; - (NSURL *)imap4URL; - (NSString *)imap4Login; diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m index 80d85398..836f534c 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m @@ -64,6 +64,10 @@ static BOOL debugOn = YES; - (NGImap4ConnectionManager *)mailManager { return [NGImap4ConnectionManager defaultConnectionManager]; } +- (NGImap4Connection *)imap4Connection { + return [[self mailManager] connectionForURL:[self imap4URL] + password:[self imap4Password]]; +} - (NSString *)relativeImap4Name { [self warnWithFormat:@"subclass should override %@", diff --git a/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m b/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m index 61873b8c..1a01a706 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m +++ b/SOGo/SoObjects/Mailer/SOGoMailBodyPart.m @@ -140,9 +140,9 @@ static BOOL debugOn = NO; NSString *enc; NSData *data; - data = [[self mailManager] fetchContentOfBodyPart:[self bodyPartIdentifier] - atURL:[self imap4URL] - password:[self imap4Password]]; + data = [[self imap4Connection] fetchContentOfBodyPart: + [self bodyPartIdentifier] + atURL:[self imap4URL]]; if (data == nil) return nil; /* check for content encodings */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index 38f61194..e88885a7 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -45,8 +45,7 @@ /* listing the available folders */ - (NSArray *)toManyRelationshipKeys { - return [[self mailManager] subfoldersForURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] subfoldersForURL:[self imap4URL]]; } - (NSArray *)toOneRelationshipKeys { NSArray *uids; @@ -97,8 +96,7 @@ if (self->selectInfo != nil) return nil; /* select info exists, => no error */ - info = [[self mailManager] infoForMailboxAtURL:[self imap4URL] - password:[self imap4Password]]; + info = [[self imap4Connection] infoForMailboxAtURL:[self imap4URL]]; if ([info isKindOfClass:[NSException class]]) return info; @@ -114,8 +112,7 @@ if (self->somfFlags.didCheckMyRights) return; - rights = [[self mailManager] myRightsForMailboxAtURL:[self imap4URL] - password:[self imap4Password]]; + rights = [[self imap4Connection] myRightsForMailboxAtURL:[self imap4URL]]; if ([rights isKindOfClass:[NSException class]]) { [self logWithFormat:@"ERROR: could not retrieve ACL: %@", rights]; return; @@ -135,33 +132,29 @@ - (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so { /* seems to return an NSArray of NSNumber's */ - return [[self mailManager] fetchUIDsInURL:[self imap4URL] - qualifier:_q sortOrdering:_so - password:[self imap4Password]]; + return [[self imap4Connection] fetchUIDsInURL:[self imap4URL] + qualifier:_q sortOrdering:_so]; } - (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts { - return [[self mailManager] fetchUIDs:_uids inURL:[self imap4URL] - parts:_parts - password:[self imap4Password]]; + return [[self imap4Connection] fetchUIDs:_uids inURL:[self imap4URL] + parts:_parts]; } - (NSException *)postData:(NSData *)_data flags:(id)_flags { - return [[self mailManager] postData:_data flags:_flags - toFolderURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] postData:_data flags:_flags + toFolderURL:[self imap4URL]]; } - (NSException *)expunge { - return [[self mailManager] expungeAtURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] expungeAtURL:[self imap4URL]]; } /* flags */ - (NSException *)addFlagsToAllMessages:(id)_f { - return [[self mailManager] addFlags:_f toAllMessagesInURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] addFlags:_f + toAllMessagesInURL:[self imap4URL]]; } /* name lookup */ @@ -195,8 +188,7 @@ sf = [NSURL URLWithString:[[sf path] stringByAppendingPathComponent:_key] relativeToURL:sf]; - if (![[self mailManager] doesMailboxExistAtURL:sf - password:[self imap4Password]]) { + if (![[self imap4Connection] doesMailboxExistAtURL:sf]) { /* We may not return 404, confuses path traversal - but we still do in the calling method. Probably the traversal process should be fixed to @@ -249,14 +241,12 @@ } - (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx { - return [[self mailManager] createMailbox:_name atURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] createMailbox:_name atURL:[self imap4URL]]; } - (NSException *)delete { /* Note: overrides SOGoObject -delete */ - return [[self mailManager] deleteMailboxAtURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] deleteMailboxAtURL:[self imap4URL]]; } - (NSException *)davMoveToTargetObject:(id)_target newName:(NSString *)_name @@ -285,8 +275,8 @@ [[self imap4URL] absoluteString], [destImapURL absoluteString]]; - return [[self mailManager] moveMailboxAtURL:[self imap4URL] toURL:destImapURL - password:[self imap4Password]]; + return [[self imap4Connection] moveMailboxAtURL:[self imap4URL] + toURL:destImapURL]; } - (NSException *)davCopyToTargetObject:(id)_target newName:(NSString *)_name inContext:(id)_ctx diff --git a/SOGo/SoObjects/Mailer/SOGoMailObject.m b/SOGo/SoObjects/Mailer/SOGoMailObject.m index 93e0aa68..ec9d5c58 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailObject.m @@ -133,8 +133,7 @@ static BOOL debugBodyStructure = NO; /* message */ - (id)fetchParts:(NSArray *)_parts { - return [[self mailManager] fetchURL:[self imap4URL] parts:_parts - password:[self imap4Password]]; + return [[self imap4Connection] fetchURL:[self imap4URL] parts:_parts]; } /* core infos */ @@ -508,12 +507,10 @@ static BOOL debugBodyStructure = NO; /* flags */ - (NSException *)addFlags:(id)_flags { - return [[self mailManager] addFlags:_flags toURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] addFlags:_flags toURL:[self imap4URL]]; } - (NSException *)removeFlags:(id)_flags { - return [[self mailManager] removeFlags:_flags toURL:[self imap4URL] - password:[self imap4Password]]; + return [[self imap4Connection] removeFlags:_flags toURL:[self imap4URL]]; } /* permissions */ @@ -656,14 +653,12 @@ static BOOL debugBodyStructure = NO; /* b) mark deleted */ - error = [[self mailManager] markURLDeleted:[self imap4URL] - password:[self imap4Password]]; + error = [[self imap4Connection] markURLDeleted:[self imap4URL]]; if (error != nil) return error; /* c) expunge */ - error = [[self mailManager] expungeAtURL:[[self container] imap4URL] - password:[self imap4Password]]; + error = [[self imap4Connection] expungeAtURL:[[self container] imap4URL]]; if (error != nil) return error; // TODO: unflag as deleted? [self flushMailCaches]; @@ -682,8 +677,7 @@ static BOOL debugBodyStructure = NO; // TODO: check for safe HTTP method - error = [[self mailManager] markURLDeleted:[self imap4URL] - password:[self imap4Password]]; + error = [[self imap4Connection] markURLDeleted:[self imap4URL]]; return error; } - (id)DELETEAction:(id)_ctx { @@ -691,12 +685,10 @@ static BOOL debugBodyStructure = NO; // TODO: ensure safe HTTP method - error = [[self mailManager] markURLDeleted:[self imap4URL] - password:[self imap4Password]]; + error = [[self imap4Connection] markURLDeleted:[self imap4URL]]; if (error != nil) return error; - error = [[self mailManager] expungeAtURL:[[self container] imap4URL] - password:[self imap4Password]]; + error = [[self imap4Connection] expungeAtURL:[[self container] imap4URL]]; if (error != nil) return error; // TODO: unflag as deleted? return [NSNumber numberWithBool:YES]; /* delete was successful */ diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 1dc8c92c..ccbc76c2 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=97 +SUBMINOR_VERSION:=98 # v0.9.96 requires libNGMime v4.5.223 # v0.9.91 requires libNGMime v4.5.222 diff --git a/SOGo/SoObjects/Mailer/common.h b/SOGo/SoObjects/Mailer/common.h index c05b9762..a11785e5 100644 --- a/SOGo/SoObjects/Mailer/common.h +++ b/SOGo/SoObjects/Mailer/common.h @@ -33,4 +33,4 @@ #include -#include +#include