+2007-06-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/SOGoObject.m ([SOGoObject
+ -_urlPreferringParticle:expectedoverThisOne:possible]): remove the
+ first 3 elements of the path array if the url returned by
+ baseURLInContext: returns a hostname.
+
+ * 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
- (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"];
+ }
}
}
{
NSMutableArray *acls;
SOGoMailAccount *mailAccount;
- NSString *path;
- NSArray *names;
- unsigned int count;
+ NSString *path, *folder;
+// NSArray *names;
+// unsigned int count;
acls = [NSMutableArray array];
mailAccount = [self mailAccountFolder];
path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]];
- names = [path componentsSeparatedByString: @"/"];
- count = [names count];
+// 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;
}
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;
}
- (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;