mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 12:25:23 +00:00
Monotone-Parent: 6075106624ecdc149d0393a0796a4e87b74a1bea
Monotone-Revision: c611aac3a435306dc4b8733414bd22f705466261 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-01-06T13:45:55 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
2010-01-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Mailer/SOGoMailAccount.m
|
||||
(-otherUsersFolderNamespaces): new method that returns all the
|
||||
namespace "folders" in the "other user" namespace. Replaces the
|
||||
old "otherUsersFolderName" method.
|
||||
(-sharedFolderNamespaces): same as above for the "shared"
|
||||
namespace.
|
||||
|
||||
* SoObjects/SOGo/SOGoDomainDefaults.m (-otherUsersFolderName)
|
||||
(-sharedFolderName): removed obsolete methods.
|
||||
|
||||
2010-01-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/MailerUI.js (Mailbox): "this.name" is now
|
||||
|
||||
@@ -83,9 +83,10 @@ typedef enum {
|
||||
- (SOGoSentFolder *) sentFolderInContext: (id)_ctx;
|
||||
- (SOGoTrashFolder *) trashFolderInContext: (id)_ctx;
|
||||
|
||||
/* user defaults */
|
||||
- (NSString *) sharedFolderName;
|
||||
- (NSString *) otherUsersFolderName;
|
||||
/* namespaces */
|
||||
|
||||
- (NSArray *) otherUsersFolderNamespaces;
|
||||
- (NSArray *) sharedFolderNamespaces;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -114,6 +114,8 @@ static NSString *sieveScriptName = @"sogo";
|
||||
}
|
||||
}
|
||||
|
||||
/* namespaces */
|
||||
|
||||
- (void) _appendNamespaces: (NSMutableArray *) folders
|
||||
{
|
||||
NSDictionary *namespaceDict;
|
||||
@@ -133,6 +135,37 @@ static NSString *sieveScriptName = @"sogo";
|
||||
[self _appendNamespace: namespace toFolders: folders];
|
||||
}
|
||||
|
||||
- (NSArray *) _namespacesWithKey: (NSString *) nsKey
|
||||
{
|
||||
NSDictionary *namespaceDict;
|
||||
NSArray *namespace;
|
||||
NGImap4Client *client;
|
||||
NSMutableArray *folders;
|
||||
|
||||
client = [[self imap4Connection] client];
|
||||
namespaceDict = [client namespace];
|
||||
namespace = [namespaceDict objectForKey: nsKey];
|
||||
if (namespace)
|
||||
{
|
||||
folders = [NSMutableArray array];
|
||||
[self _appendNamespace: namespace toFolders: folders];
|
||||
}
|
||||
else
|
||||
folders = nil;
|
||||
|
||||
return folders;
|
||||
}
|
||||
|
||||
- (NSArray *) otherUsersFolderNamespaces
|
||||
{
|
||||
return [self _namespacesWithKey: @"other users"];
|
||||
}
|
||||
|
||||
- (NSArray *) sharedFolderNamespaces
|
||||
{
|
||||
return [self _namespacesWithKey: @"shared"];
|
||||
}
|
||||
|
||||
- (NSArray *) toManyRelationshipKeys
|
||||
{
|
||||
NSMutableArray *folders;
|
||||
@@ -755,22 +788,4 @@ static NSString *sieveScriptName = @"sogo";
|
||||
return [self shortTitle];
|
||||
}
|
||||
|
||||
- (NSString *) sharedFolderName
|
||||
{
|
||||
SOGoDomainDefaults *dd;
|
||||
|
||||
dd = [[context activeUser] domainDefaults];
|
||||
|
||||
return [dd sharedFolderName];
|
||||
}
|
||||
|
||||
- (NSString *) otherUsersFolderName
|
||||
{
|
||||
SOGoDomainDefaults *dd;
|
||||
|
||||
dd = [[context activeUser] domainDefaults];
|
||||
|
||||
return [dd otherUsersFolderName];
|
||||
}
|
||||
|
||||
@end /* SOGoMailAccount */
|
||||
|
||||
@@ -74,29 +74,41 @@ static NSString *defaultUserID = @"anyone";
|
||||
|
||||
@implementation SOGoMailFolder
|
||||
|
||||
- (BOOL) _path: (NSString *) path
|
||||
isInNamespaces: (NSArray *) namespaces
|
||||
{
|
||||
int count, max;
|
||||
BOOL rc;
|
||||
|
||||
rc = NO;
|
||||
|
||||
max = [namespaces count];
|
||||
for (count = 0; !rc && count < max; count++)
|
||||
rc = [path hasPrefix: [namespaces objectAtIndex: count]];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) _adjustOwner
|
||||
{
|
||||
SOGoMailAccount *mailAccount;
|
||||
NSString *path, *folder;
|
||||
NSString *path;
|
||||
NSArray *names;
|
||||
|
||||
mailAccount = [self mailAccountFolder];
|
||||
path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]];
|
||||
|
||||
folder = [mailAccount sharedFolderName];
|
||||
if (folder && [path hasPrefix: folder])
|
||||
if ([self _path: path
|
||||
isInNamespaces: [mailAccount sharedFolderNamespaces]])
|
||||
[self setOwner: @"nobody"];
|
||||
else
|
||||
else if ([self _path: path
|
||||
isInNamespaces: [mailAccount otherUsersFolderNamespaces]])
|
||||
{
|
||||
folder = [mailAccount otherUsersFolderName];
|
||||
if (folder && [path hasPrefix: folder])
|
||||
{
|
||||
names = [path componentsSeparatedByString: @"/"];
|
||||
if ([names count] > 1)
|
||||
[self setOwner: [names objectAtIndex: 1]];
|
||||
else
|
||||
[self setOwner: @"nobody"];
|
||||
}
|
||||
names = [path componentsSeparatedByString: @"/"];
|
||||
if ([names count] > 1)
|
||||
[self setOwner: [names objectAtIndex: 1]];
|
||||
else
|
||||
[self setOwner: @"nobody"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -893,7 +905,7 @@ static NSString *defaultUserID = @"anyone";
|
||||
{
|
||||
NSMutableArray *acls;
|
||||
SOGoMailAccount *mailAccount;
|
||||
NSString *path, *folder;
|
||||
NSString *path;
|
||||
// NSArray *names;
|
||||
// unsigned int count;
|
||||
|
||||
@@ -904,17 +916,13 @@ static NSString *defaultUserID = @"anyone";
|
||||
// names = [path componentsSeparatedByString: @"/"];
|
||||
// count = [names count];
|
||||
|
||||
folder = [mailAccount sharedFolderName];
|
||||
if (folder && [path hasPrefix: folder])
|
||||
if ([self _path: path
|
||||
isInNamespaces: [mailAccount sharedFolderNamespaces]]
|
||||
|| [self _path: path
|
||||
isInNamespaces: [mailAccount sharedFolderNamespaces]])
|
||||
[acls addObject: SOGoRole_ObjectViewer];
|
||||
else
|
||||
{
|
||||
folder = [mailAccount otherUsersFolderName];
|
||||
if (folder && [path hasPrefix: folder])
|
||||
[acls addObject: SOGoRole_ObjectViewer];
|
||||
else
|
||||
[acls addObject: SoRole_Owner];
|
||||
}
|
||||
[acls addObject: SoRole_Owner];
|
||||
|
||||
return acls;
|
||||
}
|
||||
@@ -977,27 +985,29 @@ static NSString *defaultUserID = @"anyone";
|
||||
|
||||
- (NSString *) otherUsersPathToFolder
|
||||
{
|
||||
NSString *userPath, *selfPath, *otherUsers, *sharedFolders;
|
||||
NSString *userPath, *selfPath, *otherUsers;
|
||||
SOGoMailAccount *account;
|
||||
NSArray *otherUsersFolderNamespaces;
|
||||
|
||||
#warning this method should be checked
|
||||
account = [self mailAccountFolder];
|
||||
otherUsers = [account otherUsersFolderName];
|
||||
sharedFolders = [account sharedFolderName];
|
||||
otherUsersFolderNamespaces = [account otherUsersFolderNamespaces];
|
||||
|
||||
selfPath = [[self imap4URL] path];
|
||||
if ((otherUsers
|
||||
&& [selfPath hasPrefix:
|
||||
[NSString stringWithFormat: @"/%@", otherUsers]])
|
||||
|| (sharedFolders
|
||||
&& [selfPath hasPrefix:
|
||||
[NSString stringWithFormat: @"/%@", sharedFolders]]))
|
||||
if ([self _path: selfPath isInNamespaces: otherUsersFolderNamespaces]
|
||||
|| [self _path: selfPath
|
||||
isInNamespaces: [account sharedFolderNamespaces]])
|
||||
userPath = selfPath;
|
||||
else
|
||||
{
|
||||
if (otherUsers)
|
||||
userPath = [NSString stringWithFormat: @"/%@/%@%@",
|
||||
[otherUsers stringByEscapingURL],
|
||||
owner, selfPath];
|
||||
if ([otherUsersFolderNamespaces count])
|
||||
{
|
||||
/* can we really have more than one "other users" namespace? */
|
||||
otherUsers = [[otherUsersFolderNamespaces objectAtIndex: 0]
|
||||
stringByEscapingURL];
|
||||
userPath = [NSString stringWithFormat: @"/%@/%@%@",
|
||||
otherUsers, owner, selfPath];
|
||||
}
|
||||
else
|
||||
userPath = nil;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
- (BOOL) forceIMAPLoginWithEmail;
|
||||
- (BOOL) forwardEnabled;
|
||||
- (BOOL) vacationEnabled;
|
||||
- (NSString *) otherUsersFolderName;
|
||||
- (NSString *) sharedFolderName;
|
||||
- (NSString *) mailingMechanism;
|
||||
- (NSString *) smtpServer;
|
||||
- (NSString *) mailSpoolPath;
|
||||
|
||||
@@ -182,16 +182,6 @@
|
||||
return [self arrayForKey: @"SOGoMailPollingIntervals"];
|
||||
}
|
||||
|
||||
- (NSString *) otherUsersFolderName
|
||||
{
|
||||
return [self stringForKey: @"SOGoOtherUsersFolderName"];
|
||||
}
|
||||
|
||||
- (NSString *) sharedFolderName
|
||||
{
|
||||
return [self stringForKey: @"SOGoSharedFolderName"];
|
||||
}
|
||||
|
||||
- (NSString *) smtpServer
|
||||
{
|
||||
return [self stringForKey: @"SOGoSMTPServer"];
|
||||
|
||||
Reference in New Issue
Block a user