From a5380039b42abfef0c86c05d04fad0b43f6ac043 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 1 Jun 2007 05:45:12 +0000 Subject: [PATCH] Monotone-Parent: a2b85224aedbae3b50dca9ad2d087e281dc1ee27 Monotone-Revision: 77306d05ac643771e7993895fdcd2955485ad2d2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-01T05:45:12 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 +++++ SoObjects/Mailer/SOGoMailAccount.m | 18 ++++++-- SoObjects/Mailer/SOGoMailAccounts.m | 5 +++ SoObjects/Mailer/SOGoMailFolder.m | 66 +++++++++++++++++------------ 4 files changed, 68 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d8ea04c3..bcf6b1c89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2007-06-01 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder + -initWithName:newNameinContainer:newContainer]): new overriden + method setting the custom owner directly. + + * SoObjects/Mailer/SOGoMailAccounts.m ([SOGoMailAccounts + -davContentType]): same as below. + + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -davContentType]): same as below. + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -davContentType]): declare "httpd/unix-directory". diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 184274881..be0cea9f4 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -387,15 +387,24 @@ static BOOL useAltNamespace = NO; /* WebDAV */ -- (BOOL)davIsCollection { +- (NSString *) davContentType +{ + return @"httpd/unix-directory"; +} + +- (BOOL) davIsCollection +{ return YES; } -- (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx { +- (NSException *) davCreateCollection: (NSString *) _name + inContext: (id) _ctx +{ return [[self imap4Connection] createMailbox:_name atURL:[self imap4URL]]; } -- (NSString *)shortTitle { +- (NSString *) shortTitle +{ NSString *s, *login, *host; NSRange r; @@ -425,7 +434,8 @@ static BOOL useAltNamespace = NO; return [NSString stringWithFormat:@"%@@%@", login, host]; } -- (NSString *)davDisplayName { +- (NSString *) davDisplayName +{ return [self shortTitle]; } diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index d215e8e10..8e7c8a582 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -185,6 +185,11 @@ static NSString *AgenorShareLoginMarker = @".-."; return YES; } +- (NSString *) davContentType +{ + return @"httpd/unix-directory"; +} + /* acls */ - (NSArray *) aclsForUser: (NSString *) uid diff --git a/SoObjects/Mailer/SOGoMailFolder.m b/SoObjects/Mailer/SOGoMailFolder.m index f3b86ab15..88d6f516c 100644 --- a/SoObjects/Mailer/SOGoMailFolder.m +++ b/SoObjects/Mailer/SOGoMailFolder.m @@ -62,6 +62,39 @@ static BOOL useAltNamespace = NO; useAltNamespace = [ud boolForKey:@"SOGoSpecialFoldersInRoot"]; } +- (void) _adjustOwner +{ + SOGoMailAccount *mailAccount; + NSString *path; + NSArray *names; + + mailAccount = [self mailAccountFolder]; + path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]]; + + if ([path hasPrefix: [mailAccount sharedFolderName]]) + owner = @"anyone"; + else if ([path hasPrefix: [mailAccount otherUsersFolderName]]) + { + names = [path componentsSeparatedByString: @"/"]; + if ([names count] > 1) + owner = [names objectAtIndex: 1]; + else + owner = @"anyone"; + } +} + +- (id) initWithName: (NSString *) newName + inContainer: (id) newContainer +{ + if ((self = [super initWithName: newName + inContainer: newContainer])) + { + [self _adjustOwner]; + } + + return self; +} + - (void) dealloc { [filenames release]; @@ -115,6 +148,11 @@ static BOOL useAltNamespace = NO; return subfoldersURL; } +- (NSString *) davContentType +{ + return @"httpd/unix-directory"; +} + - (NSArray *) toOneRelationshipKeys { NSArray *uids; @@ -562,31 +600,6 @@ static BOOL useAltNamespace = NO; return defaultUserID; } -- (NSString *) ownerInContext: (WOContext *) localContext -{ - SOGoMailAccount *mailAccount; - NSString *path, *owner; - NSArray *names; - - mailAccount = [self mailAccountFolder]; - path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]]; - - if ([path hasPrefix: [mailAccount sharedFolderName]]) - owner = @"anyone"; - else if ([path hasPrefix: [mailAccount otherUsersFolderName]]) - { - names = [path componentsSeparatedByString: @"/"]; - if ([names count] > 1) - owner = [names objectAtIndex: 1]; - else - owner = @"anyone"; - } - else - owner = [super ownerInContext: localContext]; - - return owner; -} - - (NSString *) otherUsersPathToFolder { NSString *userPath, *selfPath, *otherUsers, *sharedFolders; @@ -604,8 +617,7 @@ static BOOL useAltNamespace = NO; else userPath = [NSString stringWithFormat: @"/%@/%@%@", [otherUsers stringByEscapingURL], - [self ownerInContext: context], - selfPath]; + owner, selfPath]; return userPath; }