Monotone-Parent: e4a4a2d80e8cd1af24e0b3ca0dbfbb60f72d55f1

Monotone-Revision: 5f3c62eeb6192df923fff5368021fbf700189341

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-06-05T14:59:30
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-06-05 14:59:30 +00:00
parent 8bb82d244b
commit 6be64211f5
2 changed files with 61 additions and 26 deletions

View File

@@ -1,3 +1,14 @@
2007-06-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder
-_adjustOwner]): sharedFolderName and otherUsersFolderName may be
nil, in which case a crash happens when calling hasPrefix:.
([SOGoMailFolder -_sharesACLs]): same as above.
([SOGoMailFolder -otherUsersPathToFolder]): same as above. If
otherUsersFolderName is nil, we return nil.
([SOGoMailFolder -httpURLForAdvisoryToUser:uid]): if we receive
nil from [self otherUsersPathToFolder], we return nil too.
2007-06-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoObject.m ([SOGoObject

View File

@@ -65,21 +65,26 @@ static BOOL useAltNamespace = NO;
- (void) _adjustOwner
{
SOGoMailAccount *mailAccount;
NSString *path;
NSString *path, *folder;
NSArray *names;
mailAccount = [self mailAccountFolder];
path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]];
if ([path hasPrefix: [mailAccount sharedFolderName]])
owner = @"anyone";
else if ([path hasPrefix: [mailAccount otherUsersFolderName]])
folder = [mailAccount sharedFolderName];
if (folder && [path hasPrefix: folder])
[self setOwner: @"anyone"];
else
{
names = [path componentsSeparatedByString: @"/"];
if ([names count] > 1)
owner = [names objectAtIndex: 1];
else
owner = @"anyone";
folder = [mailAccount otherUsersFolderName];
if (folder && [path hasPrefix: folder])
{
names = [path componentsSeparatedByString: @"/"];
if ([names count] > 1)
[self setOwner: [names objectAtIndex: 1]];
else
[self setOwner: @"anyone"];
}
}
}
@@ -525,23 +530,28 @@ static BOOL useAltNamespace = NO;
{
NSMutableArray *acls;
SOGoMailAccount *mailAccount;
NSString *path;
NSArray *names;
NSString *path, *folder;
// NSArray *names;
unsigned int count;
acls = [NSMutableArray array];
mailAccount = [self mailAccountFolder];
path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]];
names = [path componentsSeparatedByString: @"/"];
// names = [path componentsSeparatedByString: @"/"];
count = [names count];
if ([path hasPrefix: [mailAccount sharedFolderName]])
[acls addObject: SOGoRole_ObjectViewer];
else if ([path hasPrefix: [mailAccount otherUsersFolderName]])
folder = [mailAccount sharedFolderName];
if (folder && [path hasPrefix: folder])
[acls addObject: SOGoRole_ObjectViewer];
else
[acls addObject: SoRole_Owner];
{
folder = [mailAccount otherUsersFolderName];
if (folder && [path hasPrefix: folder])
[acls addObject: SOGoRole_ObjectViewer];
else
[acls addObject: SoRole_Owner];
}
return acls;
}
@@ -610,14 +620,22 @@ static BOOL useAltNamespace = NO;
sharedFolders = [account sharedFolderName];
selfPath = [[self imap4URL] path];
if ([selfPath hasPrefix: [NSString stringWithFormat: @"/%@", otherUsers]]
|| [selfPath hasPrefix:
[NSString stringWithFormat: @"/%@", sharedFolders]])
if ((otherUsers
&& [selfPath hasPrefix:
[NSString stringWithFormat: @"/%@", otherUsers]])
|| (sharedFolders
&& [selfPath hasPrefix:
[NSString stringWithFormat: @"/%@", sharedFolders]]))
userPath = selfPath;
else
userPath = [NSString stringWithFormat: @"/%@/%@%@",
[otherUsers stringByEscapingURL],
owner, selfPath];
{
if (otherUsers)
userPath = [NSString stringWithFormat: @"/%@/%@%@",
[otherUsers stringByEscapingURL],
owner, selfPath];
else
userPath = nil;
}
return userPath;
}
@@ -625,13 +643,19 @@ static BOOL useAltNamespace = NO;
- (NSString *) httpURLForAdvisoryToUser: (NSString *) uid;
{
SOGoUser *user;
NSString *otherUsersPath, *url;
user = [SOGoUser userWithLogin: uid roles: nil];
otherUsersPath = [self otherUsersPathToFolder];
if (otherUsersPath)
url = [NSString stringWithFormat: @"%@/%@%@",
[self soURLToBaseContainerForUser: uid],
[user primaryIMAP4AccountString],
otherUsersPath];
else
url = nil;
return [NSString stringWithFormat: @"%@/%@%@",
[self soURLToBaseContainerForUser: uid],
[user primaryIMAP4AccountString],
[self otherUsersPathToFolder]];
return url;
}
- (NSString *) resourceURLForAdvisoryToUser: (NSString *) uid;