Monotone-Parent: a2b85224aedbae3b50dca9ad2d087e281dc1ee27

Monotone-Revision: 77306d05ac643771e7993895fdcd2955485ad2d2

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-06-01T05:45:12
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-06-01 05:45:12 +00:00
parent 01f43b5944
commit a5380039b4
4 changed files with 68 additions and 31 deletions

View File

@ -1,5 +1,15 @@
2007-06-01 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2007-06-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* 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]): * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -davContentType]):
declare "httpd/unix-directory". declare "httpd/unix-directory".

View File

@ -387,15 +387,24 @@ static BOOL useAltNamespace = NO;
/* WebDAV */ /* WebDAV */
- (BOOL)davIsCollection { - (NSString *) davContentType
{
return @"httpd/unix-directory";
}
- (BOOL) davIsCollection
{
return YES; return YES;
} }
- (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx { - (NSException *) davCreateCollection: (NSString *) _name
inContext: (id) _ctx
{
return [[self imap4Connection] createMailbox:_name atURL:[self imap4URL]]; return [[self imap4Connection] createMailbox:_name atURL:[self imap4URL]];
} }
- (NSString *)shortTitle { - (NSString *) shortTitle
{
NSString *s, *login, *host; NSString *s, *login, *host;
NSRange r; NSRange r;
@ -425,7 +434,8 @@ static BOOL useAltNamespace = NO;
return [NSString stringWithFormat:@"%@@%@", login, host]; return [NSString stringWithFormat:@"%@@%@", login, host];
} }
- (NSString *)davDisplayName { - (NSString *) davDisplayName
{
return [self shortTitle]; return [self shortTitle];
} }

View File

@ -185,6 +185,11 @@ static NSString *AgenorShareLoginMarker = @".-.";
return YES; return YES;
} }
- (NSString *) davContentType
{
return @"httpd/unix-directory";
}
/* acls */ /* acls */
- (NSArray *) aclsForUser: (NSString *) uid - (NSArray *) aclsForUser: (NSString *) uid

View File

@ -62,6 +62,39 @@ static BOOL useAltNamespace = NO;
useAltNamespace = [ud boolForKey:@"SOGoSpecialFoldersInRoot"]; 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 - (void) dealloc
{ {
[filenames release]; [filenames release];
@ -115,6 +148,11 @@ static BOOL useAltNamespace = NO;
return subfoldersURL; return subfoldersURL;
} }
- (NSString *) davContentType
{
return @"httpd/unix-directory";
}
- (NSArray *) toOneRelationshipKeys - (NSArray *) toOneRelationshipKeys
{ {
NSArray *uids; NSArray *uids;
@ -562,31 +600,6 @@ static BOOL useAltNamespace = NO;
return defaultUserID; 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 *) otherUsersPathToFolder
{ {
NSString *userPath, *selfPath, *otherUsers, *sharedFolders; NSString *userPath, *selfPath, *otherUsers, *sharedFolders;
@ -604,8 +617,7 @@ static BOOL useAltNamespace = NO;
else else
userPath = [NSString stringWithFormat: @"/%@/%@%@", userPath = [NSString stringWithFormat: @"/%@/%@%@",
[otherUsers stringByEscapingURL], [otherUsers stringByEscapingURL],
[self ownerInContext: context], owner, selfPath];
selfPath];
return userPath; return userPath;
} }