2005-07-11 Helge Hess <helge.hess@opengroupware.org>
+ * 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,
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;
}
- (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;
}
}
- (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 {
/* IMAP4 */
+- (NGImap4Connection *)imap4Connection;
- (NGImap4ConnectionManager *)mailManager;
- (NSURL *)imap4URL;
- (NSString *)imap4Login;
- (NGImap4ConnectionManager *)mailManager {
return [NGImap4ConnectionManager defaultConnectionManager];
}
+- (NGImap4Connection *)imap4Connection {
+ return [[self mailManager] connectionForURL:[self imap4URL]
+ password:[self imap4Password]];
+}
- (NSString *)relativeImap4Name {
[self warnWithFormat:@"subclass should override %@",
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 */
/* 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;
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;
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;
- (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 */
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
}
- (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
[[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
/* 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 */
/* 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 */
/* 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];
// 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 {
// 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 */
# Version file
-SUBMINOR_VERSION:=97
+SUBMINOR_VERSION:=98
# v0.9.96 requires libNGMime v4.5.223
# v0.9.91 requires libNGMime v4.5.222
#include <NGObjWeb/SoObject+SoDAV.h>
-#include <NGImap4/NGImap4Client.h>
+#include <NGImap4/NGImap4Connection.h>