Monotone-Parent: 4f12ba210dcd4149e7496ee80e06c65b94793dd3
Monotone-Revision: 7db08f6967ccc793434ea22058755fb137e85d45 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-01T12:48:19 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
891ab5f97a
commit
1da963ff19
47
ChangeLog
47
ChangeLog
|
@ -1,5 +1,52 @@
|
||||||
2007-11-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2007-11-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* UI/MailerUI/UIxMailFolderActions.m ([UIxMailFolderActions
|
||||||
|
-deleteFolderAction]): no longer prefix the target folder with
|
||||||
|
"folder".
|
||||||
|
|
||||||
|
* UI/MailerUI/UIxMailAccountActions.m ([UIxMailAccountActions
|
||||||
|
-listMailboxesAction]): base the folder type on the folder
|
||||||
|
traversal path.
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder
|
||||||
|
-lookupName:_keyinContext:acquire:_acquire]): compare the full
|
||||||
|
traversal to the potential looked up folder with the special
|
||||||
|
folder names and return an object with the appropriate
|
||||||
|
SOGoMailFolder subclass.
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailBaseObject.m ([SOGoMailBaseObject
|
||||||
|
-traversalFromMailAccount]): don't prepend the whole string with
|
||||||
|
"/".
|
||||||
|
|
||||||
|
* SoObjects/Mailer/SOGoMailAccount.m
|
||||||
|
([-lookupSentFolder:_keyinContext:_ctx])
|
||||||
|
([-lookupDraftsFolder:_keyinContext:_ctx])
|
||||||
|
([-lookupTrashFolder:_keyinContext:_ctx])
|
||||||
|
([-lookupFiltersFolder:_key:_ctx]): removed methods.
|
||||||
|
([SOGoMailAccount -inboxFolderNameInContext:])
|
||||||
|
([SOGoMailAccount -draftsFolderNameInContext:_ctx])
|
||||||
|
([SOGoMailAccount -sentFolderNameInContext:])
|
||||||
|
([SOGoMailAccount -trashFolderNameInContext:]): no longer prefixes
|
||||||
|
the resulting name with "prefix" since we might return a nested
|
||||||
|
foldername.
|
||||||
|
([SOGoMailAccount -allFolderPaths]): prefixes all special folder
|
||||||
|
names with "/". Sorts the resulting folder list with
|
||||||
|
localizedCaseInsensitiveCompare: instead of
|
||||||
|
caseInsensitiveCompare:. No longer use the -[lookupXXX] methods
|
||||||
|
that were removed, instead, we choose the appropriate class
|
||||||
|
depending on the folder name. And since we are in SOGoMailAccount,
|
||||||
|
we don't have to compute a traversal path to match the key with
|
||||||
|
the foldernames.
|
||||||
|
([SOGoMailAccount
|
||||||
|
-folderWithTraversal:traversalandClassName:className]): new method
|
||||||
|
that returns an instance of the specified SOGoMailFolder subclass,
|
||||||
|
based on the traversal path passed as parameter.
|
||||||
|
([SOGoMailAccount -inboxFolderInContext:_ctx])
|
||||||
|
([SOGoMailAccount -draftsFolderInContext:_ctx])
|
||||||
|
([-sentFolderInContext:_ctx])
|
||||||
|
([SOGoMailAccount -trashFolderInContext:_ctx]): invoke the new
|
||||||
|
-folderWithTraversal:andClassName: method described above.
|
||||||
|
|
||||||
* SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
|
* SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
|
||||||
-primaryFetchProfile]): make use of -[NSPropertyListSerialization
|
-primaryFetchProfile]): make use of -[NSPropertyListSerialization
|
||||||
propertyListFromData:mutabilityOption:format:errorDescription:] to
|
propertyListFromData:mutabilityOption:format:errorDescription:] to
|
||||||
|
|
|
@ -35,15 +35,18 @@
|
||||||
|
|
||||||
@class NSArray;
|
@class NSArray;
|
||||||
@class NSString;
|
@class NSString;
|
||||||
|
|
||||||
@class SOGoDraftsFolder;
|
@class SOGoDraftsFolder;
|
||||||
@class SOGoMailFolder;
|
@class SOGoMailFolder;
|
||||||
|
@class SOGoSentFolder;
|
||||||
|
@class SOGoTrashFolder;
|
||||||
|
|
||||||
@interface SOGoMailAccount : SOGoMailBaseObject
|
@interface SOGoMailAccount : SOGoMailBaseObject
|
||||||
{
|
{
|
||||||
SOGoMailFolder *inboxFolder;
|
SOGoMailFolder *inboxFolder;
|
||||||
SOGoDraftsFolder *draftsFolder;
|
SOGoDraftsFolder *draftsFolder;
|
||||||
SOGoMailFolder *sentFolder;
|
SOGoSentFolder *sentFolder;
|
||||||
SOGoMailFolder *trashFolder;
|
SOGoTrashFolder *trashFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* folder pathes */
|
/* folder pathes */
|
||||||
|
@ -61,14 +64,14 @@
|
||||||
|
|
||||||
- (NSString *) inboxFolderNameInContext: (id)_ctx;
|
- (NSString *) inboxFolderNameInContext: (id)_ctx;
|
||||||
- (NSString *) draftsFolderNameInContext: (id)_ctx;
|
- (NSString *) draftsFolderNameInContext: (id)_ctx;
|
||||||
- (NSString *) sieveFolderNameInContext: (id)_ctx;
|
// - (NSString *) sieveFolderNameInContext: (id)_ctx;
|
||||||
- (NSString *) sentFolderNameInContext: (id)_ctx;
|
- (NSString *) sentFolderNameInContext: (id)_ctx;
|
||||||
- (NSString *) trashFolderNameInContext: (id)_ctx;
|
- (NSString *) trashFolderNameInContext: (id)_ctx;
|
||||||
|
|
||||||
- (SOGoMailFolder *) inboxFolderInContext: (id)_ctx;
|
- (SOGoMailFolder *) inboxFolderInContext: (id)_ctx;
|
||||||
- (SOGoDraftsFolder *) draftsFolderInContext: (id)_ctx;
|
- (SOGoDraftsFolder *) draftsFolderInContext: (id)_ctx;
|
||||||
- (SOGoMailFolder *) sentFolderInContext: (id)_ctx;
|
- (SOGoSentFolder *) sentFolderInContext: (id)_ctx;
|
||||||
- (SOGoMailFolder *) trashFolderInContext: (id)_ctx;
|
- (SOGoTrashFolder *) trashFolderInContext: (id)_ctx;
|
||||||
|
|
||||||
/* user defaults */
|
/* user defaults */
|
||||||
- (NSString *) sharedFolderName;
|
- (NSString *) sharedFolderName;
|
||||||
|
|
|
@ -35,9 +35,11 @@
|
||||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||||
#import <SoObjects/SOGo/SOGoUser.h>
|
#import <SoObjects/SOGo/SOGoUser.h>
|
||||||
|
|
||||||
|
#import "SOGoDraftsFolder.h"
|
||||||
#import "SOGoMailFolder.h"
|
#import "SOGoMailFolder.h"
|
||||||
#import "SOGoMailManager.h"
|
#import "SOGoMailManager.h"
|
||||||
#import "SOGoDraftsFolder.h"
|
#import "SOGoSentFolder.h"
|
||||||
|
#import "SOGoTrashFolder.h"
|
||||||
|
|
||||||
#import "SOGoMailAccount.h"
|
#import "SOGoMailAccount.h"
|
||||||
|
|
||||||
|
@ -177,30 +179,25 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
|
|
||||||
- (NSArray *) allFolderPaths
|
- (NSArray *) allFolderPaths
|
||||||
{
|
{
|
||||||
NSMutableArray *newFolders;
|
NSMutableArray *folderPaths;
|
||||||
NSArray *rawFolders, *mainFolders;
|
NSArray *rawFolders, *mainFolders;
|
||||||
NSString *realDraftsFolderName, *realSentFolderName, *realTrashFolderName;
|
|
||||||
|
|
||||||
rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL]];
|
rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL]];
|
||||||
|
|
||||||
realDraftsFolderName
|
mainFolders = [[NSArray arrayWithObjects:
|
||||||
= [[self draftsFolderInContext: context] traversalFromMailAccount];
|
[self inboxFolderNameInContext: context],
|
||||||
realSentFolderName
|
[self draftsFolderNameInContext: context],
|
||||||
= [[self sentFolderInContext: context] traversalFromMailAccount];
|
[self sentFolderNameInContext: context],
|
||||||
realTrashFolderName
|
[self trashFolderNameInContext: context],
|
||||||
= [[self trashFolderInContext: context] traversalFromMailAccount];
|
nil] stringsWithFormat: @"/%@"];
|
||||||
|
folderPaths = [NSMutableArray arrayWithArray: rawFolders];
|
||||||
|
[folderPaths removeObjectsInArray: mainFolders];
|
||||||
|
[folderPaths
|
||||||
|
sortUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
|
||||||
|
[folderPaths replaceObjectsInRange: NSMakeRange (0, 0)
|
||||||
|
withObjectsFromArray: mainFolders];
|
||||||
|
|
||||||
mainFolders = [NSArray arrayWithObjects: inboxFolderName,
|
return folderPaths;
|
||||||
realDraftsFolderName,
|
|
||||||
realSentFolderName,
|
|
||||||
realTrashFolderName, nil];
|
|
||||||
newFolders = [NSMutableArray arrayWithArray: rawFolders];
|
|
||||||
[newFolders removeObjectsInArray: mainFolders];
|
|
||||||
[newFolders sortUsingSelector: @selector (caseInsensitiveCompare:)];
|
|
||||||
[newFolders replaceObjectsInRange: NSMakeRange (0, 0)
|
|
||||||
withObjectsFromArray: mainFolders];
|
|
||||||
|
|
||||||
return newFolders;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IMAP4 */
|
/* IMAP4 */
|
||||||
|
@ -268,74 +265,32 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
|
|
||||||
/* name lookup */
|
/* name lookup */
|
||||||
|
|
||||||
- (id) lookupFolder: (NSString *) _key
|
|
||||||
ofClassNamed: (NSString *) _cn
|
|
||||||
inContext: (id) _cx
|
|
||||||
{
|
|
||||||
Class clazz;
|
|
||||||
SOGoMailFolder *folder;
|
|
||||||
|
|
||||||
if ((clazz = NSClassFromString(_cn)) == Nil)
|
|
||||||
{
|
|
||||||
[self logWithFormat:@"ERROR: did not find class '%@' for key: '%@'",
|
|
||||||
_cn, _key];
|
|
||||||
return [NSException exceptionWithHTTPStatus:500 /* server error */
|
|
||||||
reason:@"did not find mail folder class!"];
|
|
||||||
}
|
|
||||||
|
|
||||||
folder = [clazz objectWithName: _key inContainer: self];
|
|
||||||
|
|
||||||
return folder;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) lookupSentFolder: (NSString *) _key
|
|
||||||
inContext: (id) _ctx
|
|
||||||
{
|
|
||||||
return [self lookupFolder: _key ofClassNamed: @"SOGoSentFolder"
|
|
||||||
inContext: _ctx];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) lookupDraftsFolder: (NSString *) _key
|
|
||||||
inContext: (id) _ctx
|
|
||||||
{
|
|
||||||
return [self lookupFolder: _key ofClassNamed: @"SOGoDraftsFolder"
|
|
||||||
inContext: _ctx];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) lookupTrashFolder: (NSString *) _key
|
|
||||||
inContext: (id) _ctx
|
|
||||||
{
|
|
||||||
return [self lookupFolder: _key ofClassNamed: @"SOGoTrashFolder"
|
|
||||||
inContext: _ctx];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) lookupFiltersFolder: (NSString *) _key inContext: (id) _ctx
|
|
||||||
{
|
|
||||||
return [self lookupFolder:_key ofClassNamed:@"SOGoSieveScriptsFolder"
|
|
||||||
inContext:_ctx];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) lookupName: (NSString *) _key
|
- (id) lookupName: (NSString *) _key
|
||||||
inContext: (id)_ctx
|
inContext: (id)_ctx
|
||||||
acquire: (BOOL) _flag
|
acquire: (BOOL) _flag
|
||||||
{
|
{
|
||||||
|
NSString *folderName;
|
||||||
|
Class klazz;
|
||||||
id obj;
|
id obj;
|
||||||
|
|
||||||
if ([_key hasPrefix: @"folder"])
|
if ([_key hasPrefix: @"folder"])
|
||||||
{
|
{
|
||||||
// TODO: those should be product.plist bindings? (can't be class bindings
|
folderName = [_key substringFromIndex: 6];
|
||||||
// though because they are 'per-account')
|
if ([folderName
|
||||||
if ([_key isEqualToString: [self sentFolderNameInContext: _ctx]])
|
isEqualToString: [self sentFolderNameInContext: _ctx]])
|
||||||
obj = [self lookupSentFolder: _key inContext: _ctx];
|
klazz = [SOGoSentFolder class];
|
||||||
else if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]])
|
else if ([folderName
|
||||||
obj = [self lookupDraftsFolder: _key inContext: _ctx];
|
isEqualToString: [self draftsFolderNameInContext: _ctx]])
|
||||||
else if ([_key isEqualToString: [self trashFolderNameInContext: _ctx]])
|
klazz = [SOGoDraftsFolder class];
|
||||||
obj = [self lookupTrashFolder: _key inContext: _ctx];
|
else if ([folderName
|
||||||
// else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
isEqualToString: [self trashFolderNameInContext: _ctx]])
|
||||||
// obj = [self lookupFiltersFolder: _key inContext: _ctx];
|
klazz = [SOGoTrashFolder class];
|
||||||
|
/* else if ([folderName isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
||||||
|
obj = [self lookupFiltersFolder: _key inContext: _ctx]; */
|
||||||
else
|
else
|
||||||
obj = [self lookupFolder: _key ofClassNamed: @"SOGoMailFolder"
|
klazz = [SOGoMailFolder class];
|
||||||
inContext: _ctx];
|
|
||||||
|
obj = [klazz objectWithName: _key inContainer: self];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
obj = [super lookupName: _key inContext: _ctx acquire: NO];
|
obj = [super lookupName: _key inContext: _ctx acquire: NO];
|
||||||
|
@ -352,7 +307,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
- (NSString *) inboxFolderNameInContext: (id)_ctx
|
- (NSString *) inboxFolderNameInContext: (id)_ctx
|
||||||
{
|
{
|
||||||
/* cannot be changed in Cyrus ? */
|
/* cannot be changed in Cyrus ? */
|
||||||
return [NSString stringWithFormat: @"folder%@", inboxFolderName];
|
return inboxFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) _userFolderNameWithPurpose: (NSString *) purpose
|
- (NSString *) _userFolderNameWithPurpose: (NSString *) purpose
|
||||||
|
@ -380,13 +335,13 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
if (!folderName)
|
if (!folderName)
|
||||||
folderName = draftsFolderName;
|
folderName = draftsFolderName;
|
||||||
|
|
||||||
return [NSString stringWithFormat: @"folder%@", folderName];
|
return folderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) sieveFolderNameInContext: (id) _ctx
|
// - (NSString *) sieveFolderNameInContext: (id) _ctx
|
||||||
{
|
// {
|
||||||
return [NSString stringWithFormat: @"folder%@", sieveFolderName];
|
// return sieveFolderName;
|
||||||
}
|
// }
|
||||||
|
|
||||||
- (NSString *) sentFolderNameInContext: (id)_ctx
|
- (NSString *) sentFolderNameInContext: (id)_ctx
|
||||||
{
|
{
|
||||||
|
@ -396,7 +351,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
if (!folderName)
|
if (!folderName)
|
||||||
folderName = sentFolderName;
|
folderName = sentFolderName;
|
||||||
|
|
||||||
return [NSString stringWithFormat: @"folder%@", folderName];
|
return folderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) trashFolderNameInContext: (id)_ctx
|
- (NSString *) trashFolderNameInContext: (id)_ctx
|
||||||
|
@ -407,7 +362,38 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
if (!folderName)
|
if (!folderName)
|
||||||
folderName = trashFolderName;
|
folderName = trashFolderName;
|
||||||
|
|
||||||
return [NSString stringWithFormat: @"folder%@", folderName];
|
return folderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) folderWithTraversal: (NSString *) traversal
|
||||||
|
andClassName: (NSString *) className
|
||||||
|
{
|
||||||
|
NSArray *paths;
|
||||||
|
NSString *currentName;
|
||||||
|
id currentContainer;
|
||||||
|
unsigned int count, max;
|
||||||
|
Class clazz;
|
||||||
|
|
||||||
|
currentContainer = self;
|
||||||
|
paths = [traversal componentsSeparatedByString: @"/"];
|
||||||
|
|
||||||
|
if (!className)
|
||||||
|
clazz = [SOGoMailFolder class];
|
||||||
|
else
|
||||||
|
clazz = NSClassFromString (className);
|
||||||
|
|
||||||
|
max = [paths count];
|
||||||
|
for (count = 0; count < max - 1; count++)
|
||||||
|
{
|
||||||
|
currentName = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[paths objectAtIndex: count]];
|
||||||
|
currentContainer = [SOGoMailFolder objectWithName: currentName
|
||||||
|
inContainer: currentContainer];
|
||||||
|
}
|
||||||
|
currentName = [NSString stringWithFormat: @"folder%@",
|
||||||
|
[paths objectAtIndex: max - 1]];
|
||||||
|
|
||||||
|
return [clazz objectWithName: currentName inContainer: currentContainer];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoMailFolder *) inboxFolderInContext: (id) _ctx
|
- (SOGoMailFolder *) inboxFolderInContext: (id) _ctx
|
||||||
|
@ -415,8 +401,9 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
// TODO: use some profile to determine real location, use a -traverse lookup
|
// TODO: use some profile to determine real location, use a -traverse lookup
|
||||||
if (!inboxFolder)
|
if (!inboxFolder)
|
||||||
{
|
{
|
||||||
inboxFolder = [self lookupName: [self inboxFolderNameInContext: _ctx]
|
inboxFolder
|
||||||
inContext: _ctx acquire: NO];
|
= [self folderWithTraversal: [self inboxFolderNameInContext: _ctx]
|
||||||
|
andClassName: nil];
|
||||||
[inboxFolder retain];
|
[inboxFolder retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,43 +417,36 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
||||||
if (!draftsFolder)
|
if (!draftsFolder)
|
||||||
{
|
{
|
||||||
draftsFolder
|
draftsFolder
|
||||||
= [self lookupName: [self draftsFolderNameInContext:_ctx]
|
= [self folderWithTraversal: [self draftsFolderNameInContext: _ctx]
|
||||||
inContext: _ctx acquire: NO];
|
andClassName: @"SOGoDraftsFolder"];
|
||||||
// if (![draftsFolder isNotNull])
|
|
||||||
// draftsFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
|
|
||||||
// reason: @"did not find Drafts folder!"];
|
|
||||||
[draftsFolder retain];
|
[draftsFolder retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
return draftsFolder;
|
return draftsFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoMailFolder *) sentFolderInContext: (id) _ctx
|
- (SOGoSentFolder *) sentFolderInContext: (id) _ctx
|
||||||
{
|
{
|
||||||
// TODO: use some profile to determine real location, use a -traverse lookup
|
// TODO: use some profile to determine real location, use a -traverse lookup
|
||||||
|
|
||||||
if (!sentFolder)
|
if (!sentFolder)
|
||||||
{
|
{
|
||||||
sentFolder = [self lookupName: [self sentFolderNameInContext:_ctx]
|
sentFolder
|
||||||
inContext: _ctx acquire: NO];
|
= [self folderWithTraversal: [self sentFolderNameInContext: _ctx]
|
||||||
// if (![sentFolder isNotNull])
|
andClassName: @"SOGoSentFolder"];
|
||||||
// sentFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
|
|
||||||
// reason: @"did not find Sent folder!"];
|
|
||||||
[sentFolder retain];
|
[sentFolder retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
return sentFolder;
|
return sentFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoMailFolder *) trashFolderInContext: (id) _ctx
|
- (SOGoTrashFolder *) trashFolderInContext: (id) _ctx
|
||||||
{
|
{
|
||||||
if (!trashFolder)
|
if (!trashFolder)
|
||||||
{
|
{
|
||||||
trashFolder = [self lookupName: [self trashFolderNameInContext: _ctx]
|
trashFolder
|
||||||
inContext: _ctx acquire: NO];
|
= [self folderWithTraversal: [self trashFolderNameInContext: _ctx]
|
||||||
// if (![trashFolder isNotNull])
|
andClassName: @"SOGoTrashFolder"];
|
||||||
// trashFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
|
|
||||||
// reason: @"did not find Trash folder!"];
|
|
||||||
[trashFolder retain];
|
[trashFolder retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,10 @@ static BOOL debugOn = YES;
|
||||||
NSMutableString *currentTraversal;
|
NSMutableString *currentTraversal;
|
||||||
|
|
||||||
currentTraversal = [container traversalFromMailAccount];
|
currentTraversal = [container traversalFromMailAccount];
|
||||||
[currentTraversal appendFormat: @"/%@", [self relativeImap4Name]];
|
if ([container isKindOfClass: [SOGoMailAccount class]])
|
||||||
|
[currentTraversal appendString: [self relativeImap4Name]];
|
||||||
|
else
|
||||||
|
[currentTraversal appendFormat: @"/%@", [self relativeImap4Name]];
|
||||||
|
|
||||||
return currentTraversal;
|
return currentTraversal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,10 +299,34 @@ static NSString *defaultUserID = @"anyone";
|
||||||
inContext: (id)_ctx
|
inContext: (id)_ctx
|
||||||
acquire: (BOOL) _acquire
|
acquire: (BOOL) _acquire
|
||||||
{
|
{
|
||||||
|
NSString *folderName, *className;
|
||||||
|
SOGoMailAccount *mailAccount;
|
||||||
id obj;
|
id obj;
|
||||||
|
|
||||||
if ([_key hasPrefix: @"folder"])
|
if ([_key hasPrefix: @"folder"])
|
||||||
obj = [SOGoMailFolder objectWithName: _key inContainer: self];
|
{
|
||||||
|
mailAccount = [self mailAccountFolder];
|
||||||
|
folderName = [NSString stringWithFormat: @"%@/%@",
|
||||||
|
[self traversalFromMailAccount],
|
||||||
|
[_key substringFromIndex: 6]];
|
||||||
|
if ([folderName
|
||||||
|
isEqualToString: [mailAccount sentFolderNameInContext: _ctx]])
|
||||||
|
className = @"SOGoSentFolder";
|
||||||
|
else if ([folderName isEqualToString:
|
||||||
|
[mailAccount draftsFolderNameInContext: _ctx]])
|
||||||
|
className = @"SOGoDraftsFolder";
|
||||||
|
else if ([folderName isEqualToString:
|
||||||
|
[mailAccount trashFolderNameInContext: _ctx]])
|
||||||
|
className = @"SOGoTrashFolder";
|
||||||
|
/* else if ([folderName isEqualToString:
|
||||||
|
[mailAccount sieveFolderNameInContext: _ctx]])
|
||||||
|
obj = [self lookupFiltersFolder: _key inContext: _ctx]; */
|
||||||
|
else
|
||||||
|
className = @"SOGoMailFolder";
|
||||||
|
|
||||||
|
obj = [NSClassFromString (className)
|
||||||
|
objectWithName: _key inContainer: self];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ([[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]])
|
if ([[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]])
|
||||||
|
@ -394,22 +418,24 @@ static NSString *defaultUserID = @"anyone";
|
||||||
{
|
{
|
||||||
// TODO: detect Trash/Sent/Drafts folders
|
// TODO: detect Trash/Sent/Drafts folders
|
||||||
SOGoMailAccount *account;
|
SOGoMailAccount *account;
|
||||||
NSString *n;
|
NSString *name;
|
||||||
|
|
||||||
if (folderType != nil)
|
if (!folderType)
|
||||||
return folderType;
|
{
|
||||||
|
account = [self mailAccountFolder];
|
||||||
account = [self mailAccountFolder];
|
name = [self traversalFromMailAccount];
|
||||||
n = nameInContainer;
|
|
||||||
|
|
||||||
if ([n isEqualToString:[account trashFolderNameInContext:nil]])
|
if ([name isEqualToString: [account trashFolderNameInContext: nil]])
|
||||||
folderType = @"IPF.Trash";
|
folderType = @"IPF.Trash";
|
||||||
else if ([n isEqualToString:[account inboxFolderNameInContext:nil]])
|
else if ([name
|
||||||
folderType = @"IPF.Inbox";
|
isEqualToString: [account inboxFolderNameInContext: nil]])
|
||||||
else if ([n isEqualToString:[account sentFolderNameInContext:nil]])
|
folderType = @"IPF.Inbox";
|
||||||
folderType = @"IPF.Sent";
|
else if ([name
|
||||||
else
|
isEqualToString: [account sentFolderNameInContext: nil]])
|
||||||
folderType = @"IPF.Folder";
|
folderType = @"IPF.Sent";
|
||||||
|
else
|
||||||
|
folderType = @"IPF.Folder";
|
||||||
|
}
|
||||||
|
|
||||||
return folderType;
|
return folderType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,6 @@
|
||||||
"Please select only one message to print." = "Please select only one message to print.";
|
"Please select only one message to print." = "Please select only one message to print.";
|
||||||
|
|
||||||
"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!";
|
"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!";
|
||||||
"You need to choose a root subfolder!" = "You need to choose a root subfolder!";
|
|
||||||
|
|
||||||
"Moving a message into its own folder is impossible!"
|
"Moving a message into its own folder is impossible!"
|
||||||
= "Moving a message into its own folder is impossible!";
|
= "Moving a message into its own folder is impossible!";
|
||||||
|
|
|
@ -217,7 +217,6 @@
|
||||||
"Please select only one message to print." = "Veuillez ne sélectionner qu'un seul message à imprimer.";
|
"Please select only one message to print." = "Veuillez ne sélectionner qu'un seul message à imprimer.";
|
||||||
|
|
||||||
"You need to choose a non-virtual folder!" = "Vous devez choisir un dossier non-virtuel.";
|
"You need to choose a non-virtual folder!" = "Vous devez choisir un dossier non-virtuel.";
|
||||||
"You need to choose a root subfolder!" = "Vous devez choisir un sous-dossier de la racine.";
|
|
||||||
|
|
||||||
"Moving a message into its own folder is impossible!"
|
"Moving a message into its own folder is impossible!"
|
||||||
= "Le déplacement d'un message dans son propre dossier est impossible.";
|
= "Le déplacement d'un message dans son propre dossier est impossible.";
|
||||||
|
|
|
@ -200,7 +200,6 @@
|
||||||
"Please select only one message to print." = "Bitte wählen Sie nur eine Nachricht zum Drucken aus.";
|
"Please select only one message to print." = "Bitte wählen Sie nur eine Nachricht zum Drucken aus.";
|
||||||
|
|
||||||
"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!";
|
"You need to choose a non-virtual folder!" = "You need to choose a non-virtual folder!";
|
||||||
"You need to choose a root subfolder!" = "You need to choose a root subfolder!";
|
|
||||||
|
|
||||||
"Moving a message into its own folder is impossible!"
|
"Moving a message into its own folder is impossible!"
|
||||||
= "Moving a message into its own folder is impossible!";
|
= "Moving a message into its own folder is impossible!";
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
@interface UIxMailAccountActions : WODirectAction
|
@interface UIxMailAccountActions : WODirectAction
|
||||||
{
|
{
|
||||||
NSString *draftFolderName;
|
NSString *inboxFolderName;
|
||||||
|
NSString *draftsFolderName;
|
||||||
NSString *sentFolderName;
|
NSString *sentFolderName;
|
||||||
NSString *trashFolderName;
|
NSString *trashFolderName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#import <SoObjects/Mailer/SOGoMailAccount.h>
|
#import <SoObjects/Mailer/SOGoMailAccount.h>
|
||||||
#import <SoObjects/Mailer/SOGoDraftObject.h>
|
#import <SoObjects/Mailer/SOGoDraftObject.h>
|
||||||
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
|
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
|
||||||
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||||
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
||||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||||
|
|
||||||
|
@ -40,17 +41,56 @@
|
||||||
|
|
||||||
@implementation UIxMailAccountActions
|
@implementation UIxMailAccountActions
|
||||||
|
|
||||||
- (NSString *) _folderType: (NSString *) baseName
|
- (id) init
|
||||||
|
{
|
||||||
|
if ((self = [super init]))
|
||||||
|
{
|
||||||
|
inboxFolderName = nil;
|
||||||
|
draftsFolderName = nil;
|
||||||
|
sentFolderName = nil;
|
||||||
|
trashFolderName = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[inboxFolderName release];
|
||||||
|
[draftsFolderName release];
|
||||||
|
[sentFolderName release];
|
||||||
|
[trashFolderName release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) _folderType: (NSString *) folderName
|
||||||
{
|
{
|
||||||
NSString *folderType;
|
NSString *folderType;
|
||||||
|
SOGoMailAccount *co;
|
||||||
|
NSArray *specialFolders;
|
||||||
|
|
||||||
if ([baseName isEqualToString: @"INBOX"])
|
if (!inboxFolderName)
|
||||||
|
{
|
||||||
|
co = [self clientObject];
|
||||||
|
specialFolders = [[NSArray arrayWithObjects:
|
||||||
|
[co inboxFolderNameInContext: context],
|
||||||
|
[co draftsFolderNameInContext: context],
|
||||||
|
[co sentFolderNameInContext: context],
|
||||||
|
[co trashFolderNameInContext: context],
|
||||||
|
nil] stringsWithFormat: @"/%@"];
|
||||||
|
ASSIGN (inboxFolderName, [specialFolders objectAtIndex: 0]);
|
||||||
|
ASSIGN (draftsFolderName, [specialFolders objectAtIndex: 1]);
|
||||||
|
ASSIGN (sentFolderName, [specialFolders objectAtIndex: 2]);
|
||||||
|
ASSIGN (trashFolderName, [specialFolders objectAtIndex: 3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([folderName isEqualToString: inboxFolderName])
|
||||||
folderType = @"inbox";
|
folderType = @"inbox";
|
||||||
else if ([baseName isEqualToString: draftFolderName])
|
else if ([folderName isEqualToString: draftsFolderName])
|
||||||
folderType = @"draft";
|
folderType = @"draft";
|
||||||
else if ([baseName isEqualToString: sentFolderName])
|
else if ([folderName isEqualToString: sentFolderName])
|
||||||
folderType = @"sent";
|
folderType = @"sent";
|
||||||
else if ([baseName isEqualToString: trashFolderName])
|
else if ([folderName isEqualToString: trashFolderName])
|
||||||
folderType = @"trash";
|
folderType = @"trash";
|
||||||
else
|
else
|
||||||
folderType = @"folder";
|
folderType = @"folder";
|
||||||
|
@ -58,34 +98,20 @@
|
||||||
return folderType;
|
return folderType;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *) _lineForFolder: (NSString *) folder
|
|
||||||
{
|
|
||||||
NSArray *parts;
|
|
||||||
NSMutableDictionary *folderData;
|
|
||||||
NSString *baseName;
|
|
||||||
|
|
||||||
folderData = [NSMutableDictionary dictionary];
|
|
||||||
parts = [folder componentsSeparatedByString: @"/"];
|
|
||||||
baseName = [parts lastObject];
|
|
||||||
[folderData setObject: folder forKey: @"path"];
|
|
||||||
[folderData setObject: [self _folderType: baseName]
|
|
||||||
forKey: @"type"];
|
|
||||||
|
|
||||||
return folderData;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *) _jsonFolders: (NSEnumerator *) rawFolders
|
- (NSArray *) _jsonFolders: (NSEnumerator *) rawFolders
|
||||||
{
|
{
|
||||||
NSMutableArray *folders;
|
NSMutableArray *folders;
|
||||||
NSString *currentFolder;
|
NSString *currentFolder;
|
||||||
|
NSDictionary *folderData;
|
||||||
|
|
||||||
folders = [NSMutableArray array];
|
folders = [NSMutableArray array];
|
||||||
|
while ((currentFolder = [rawFolders nextObject]))
|
||||||
currentFolder = [rawFolders nextObject];
|
|
||||||
while (currentFolder)
|
|
||||||
{
|
{
|
||||||
[folders addObject: [self _lineForFolder: currentFolder]];
|
folderData = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
currentFolder = [rawFolders nextObject];
|
currentFolder, @"path",
|
||||||
|
[self _folderType: currentFolder], @"type",
|
||||||
|
nil];
|
||||||
|
[folders addObject: folderData];
|
||||||
}
|
}
|
||||||
|
|
||||||
return folders;
|
return folders;
|
||||||
|
@ -94,19 +120,14 @@
|
||||||
- (WOResponse *) listMailboxesAction
|
- (WOResponse *) listMailboxesAction
|
||||||
{
|
{
|
||||||
SOGoMailAccount *co;
|
SOGoMailAccount *co;
|
||||||
NSArray *rawFolders, *folders;
|
NSEnumerator *rawFolders;
|
||||||
|
NSArray *folders;
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
|
|
||||||
co = [self clientObject];
|
co = [self clientObject];
|
||||||
draftFolderName = [[co draftsFolderNameInContext: context]
|
|
||||||
substringFromIndex: 6];
|
|
||||||
sentFolderName = [[co sentFolderNameInContext: context]
|
|
||||||
substringFromIndex: 6];
|
|
||||||
trashFolderName = [[co trashFolderNameInContext: context]
|
|
||||||
substringFromIndex: 6];
|
|
||||||
|
|
||||||
rawFolders = [co allFolderPaths];
|
rawFolders = [[co allFolderPaths] objectEnumerator];
|
||||||
folders = [self _jsonFolders: [rawFolders objectEnumerator]];
|
folders = [self _jsonFolders: rawFolders];
|
||||||
|
|
||||||
response = [self responseWithStatus: 200];
|
response = [self responseWithStatus: 200];
|
||||||
[response setHeader: @"text/plain; charset=utf-8"
|
[response setHeader: @"text/plain; charset=utf-8"
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
trashFolderName
|
trashFolderName
|
||||||
= [[co mailAccountFolder] trashFolderNameInContext: context];
|
= [[co mailAccountFolder] trashFolderNameInContext: context];
|
||||||
path = [NSString stringWithFormat: @"/%@/%@",
|
path = [NSString stringWithFormat: @"/%@/%@",
|
||||||
[trashFolderName substringFromIndex: 6], folderName];
|
trashFolderName, folderName];
|
||||||
destURL = [[NSURL alloc] initWithScheme: [srcURL scheme]
|
destURL = [[NSURL alloc] initWithScheme: [srcURL scheme]
|
||||||
host: [srcURL host] path: path];
|
host: [srcURL host] path: path];
|
||||||
[destURL autorelease];
|
[destURL autorelease];
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
[mailSettings autorelease];
|
[mailSettings autorelease];
|
||||||
}
|
}
|
||||||
[ud setObject: mailSettings forKey: @"Mail"];
|
[ud setObject: mailSettings forKey: @"Mail"];
|
||||||
[mailSettings setObject: [co relativeImap4Name]
|
[mailSettings setObject: [co traversalFromMailAccount]
|
||||||
forKey: [NSString stringWithFormat: @"%@Folder",
|
forKey: [NSString stringWithFormat: @"%@Folder",
|
||||||
purpose]];
|
purpose]];
|
||||||
[ud synchronize];
|
[ud synchronize];
|
||||||
|
|
|
@ -1393,13 +1393,8 @@ function _onMenuChangeToXXXFolder(event, folder) {
|
||||||
window.alert(labels["You need to choose a non-virtual folder!"]);
|
window.alert(labels["You need to choose a non-virtual folder!"]);
|
||||||
else {
|
else {
|
||||||
var folderID = document.menuTarget.getAttribute("dataname");
|
var folderID = document.menuTarget.getAttribute("dataname");
|
||||||
var number = folderID.split("/").length;
|
var urlstr = URLForFolderID(folderID) + "/setAs" + folder + "Folder";
|
||||||
if (number > 3)
|
triggerAjaxRequest(urlstr, folderOperationCallback);
|
||||||
window.alert(labels["You need to choose a root subfolder!"]);
|
|
||||||
else {
|
|
||||||
var urlstr = URLForFolderID(folderID) + "/setAs" + folder + "Folder";
|
|
||||||
triggerAjaxRequest(urlstr, folderOperationCallback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue