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>
|
||||
|
||||
* 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
|
||||
-primaryFetchProfile]): make use of -[NSPropertyListSerialization
|
||||
propertyListFromData:mutabilityOption:format:errorDescription:] to
|
||||
|
|
|
@ -35,15 +35,18 @@
|
|||
|
||||
@class NSArray;
|
||||
@class NSString;
|
||||
|
||||
@class SOGoDraftsFolder;
|
||||
@class SOGoMailFolder;
|
||||
@class SOGoSentFolder;
|
||||
@class SOGoTrashFolder;
|
||||
|
||||
@interface SOGoMailAccount : SOGoMailBaseObject
|
||||
{
|
||||
SOGoMailFolder *inboxFolder;
|
||||
SOGoDraftsFolder *draftsFolder;
|
||||
SOGoMailFolder *sentFolder;
|
||||
SOGoMailFolder *trashFolder;
|
||||
SOGoSentFolder *sentFolder;
|
||||
SOGoTrashFolder *trashFolder;
|
||||
}
|
||||
|
||||
/* folder pathes */
|
||||
|
@ -61,14 +64,14 @@
|
|||
|
||||
- (NSString *) inboxFolderNameInContext: (id)_ctx;
|
||||
- (NSString *) draftsFolderNameInContext: (id)_ctx;
|
||||
- (NSString *) sieveFolderNameInContext: (id)_ctx;
|
||||
// - (NSString *) sieveFolderNameInContext: (id)_ctx;
|
||||
- (NSString *) sentFolderNameInContext: (id)_ctx;
|
||||
- (NSString *) trashFolderNameInContext: (id)_ctx;
|
||||
|
||||
- (SOGoMailFolder *) inboxFolderInContext: (id)_ctx;
|
||||
- (SOGoDraftsFolder *) draftsFolderInContext: (id)_ctx;
|
||||
- (SOGoMailFolder *) sentFolderInContext: (id)_ctx;
|
||||
- (SOGoMailFolder *) trashFolderInContext: (id)_ctx;
|
||||
- (SOGoSentFolder *) sentFolderInContext: (id)_ctx;
|
||||
- (SOGoTrashFolder *) trashFolderInContext: (id)_ctx;
|
||||
|
||||
/* user defaults */
|
||||
- (NSString *) sharedFolderName;
|
||||
|
|
|
@ -35,9 +35,11 @@
|
|||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
|
||||
#import "SOGoDraftsFolder.h"
|
||||
#import "SOGoMailFolder.h"
|
||||
#import "SOGoMailManager.h"
|
||||
#import "SOGoDraftsFolder.h"
|
||||
#import "SOGoSentFolder.h"
|
||||
#import "SOGoTrashFolder.h"
|
||||
|
||||
#import "SOGoMailAccount.h"
|
||||
|
||||
|
@ -177,30 +179,25 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
|
||||
- (NSArray *) allFolderPaths
|
||||
{
|
||||
NSMutableArray *newFolders;
|
||||
NSMutableArray *folderPaths;
|
||||
NSArray *rawFolders, *mainFolders;
|
||||
NSString *realDraftsFolderName, *realSentFolderName, *realTrashFolderName;
|
||||
|
||||
rawFolders = [[self imap4Connection] allFoldersForURL: [self imap4URL]];
|
||||
|
||||
realDraftsFolderName
|
||||
= [[self draftsFolderInContext: context] traversalFromMailAccount];
|
||||
realSentFolderName
|
||||
= [[self sentFolderInContext: context] traversalFromMailAccount];
|
||||
realTrashFolderName
|
||||
= [[self trashFolderInContext: context] traversalFromMailAccount];
|
||||
mainFolders = [[NSArray arrayWithObjects:
|
||||
[self inboxFolderNameInContext: context],
|
||||
[self draftsFolderNameInContext: context],
|
||||
[self sentFolderNameInContext: context],
|
||||
[self trashFolderNameInContext: context],
|
||||
nil] stringsWithFormat: @"/%@"];
|
||||
folderPaths = [NSMutableArray arrayWithArray: rawFolders];
|
||||
[folderPaths removeObjectsInArray: mainFolders];
|
||||
[folderPaths
|
||||
sortUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
|
||||
[folderPaths replaceObjectsInRange: NSMakeRange (0, 0)
|
||||
withObjectsFromArray: mainFolders];
|
||||
|
||||
mainFolders = [NSArray arrayWithObjects: inboxFolderName,
|
||||
realDraftsFolderName,
|
||||
realSentFolderName,
|
||||
realTrashFolderName, nil];
|
||||
newFolders = [NSMutableArray arrayWithArray: rawFolders];
|
||||
[newFolders removeObjectsInArray: mainFolders];
|
||||
[newFolders sortUsingSelector: @selector (caseInsensitiveCompare:)];
|
||||
[newFolders replaceObjectsInRange: NSMakeRange (0, 0)
|
||||
withObjectsFromArray: mainFolders];
|
||||
|
||||
return newFolders;
|
||||
return folderPaths;
|
||||
}
|
||||
|
||||
/* IMAP4 */
|
||||
|
@ -268,74 +265,32 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
|
||||
/* 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
|
||||
inContext: (id)_ctx
|
||||
acquire: (BOOL) _flag
|
||||
{
|
||||
NSString *folderName;
|
||||
Class klazz;
|
||||
id obj;
|
||||
|
||||
if ([_key hasPrefix: @"folder"])
|
||||
{
|
||||
// TODO: those should be product.plist bindings? (can't be class bindings
|
||||
// though because they are 'per-account')
|
||||
if ([_key isEqualToString: [self sentFolderNameInContext: _ctx]])
|
||||
obj = [self lookupSentFolder: _key inContext: _ctx];
|
||||
else if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]])
|
||||
obj = [self lookupDraftsFolder: _key inContext: _ctx];
|
||||
else if ([_key isEqualToString: [self trashFolderNameInContext: _ctx]])
|
||||
obj = [self lookupTrashFolder: _key inContext: _ctx];
|
||||
// else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
||||
// obj = [self lookupFiltersFolder: _key inContext: _ctx];
|
||||
folderName = [_key substringFromIndex: 6];
|
||||
if ([folderName
|
||||
isEqualToString: [self sentFolderNameInContext: _ctx]])
|
||||
klazz = [SOGoSentFolder class];
|
||||
else if ([folderName
|
||||
isEqualToString: [self draftsFolderNameInContext: _ctx]])
|
||||
klazz = [SOGoDraftsFolder class];
|
||||
else if ([folderName
|
||||
isEqualToString: [self trashFolderNameInContext: _ctx]])
|
||||
klazz = [SOGoTrashFolder class];
|
||||
/* else if ([folderName isEqualToString: [self sieveFolderNameInContext: _ctx]])
|
||||
obj = [self lookupFiltersFolder: _key inContext: _ctx]; */
|
||||
else
|
||||
obj = [self lookupFolder: _key ofClassNamed: @"SOGoMailFolder"
|
||||
inContext: _ctx];
|
||||
klazz = [SOGoMailFolder class];
|
||||
|
||||
obj = [klazz objectWithName: _key inContainer: self];
|
||||
}
|
||||
else
|
||||
obj = [super lookupName: _key inContext: _ctx acquire: NO];
|
||||
|
@ -352,7 +307,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
- (NSString *) inboxFolderNameInContext: (id)_ctx
|
||||
{
|
||||
/* cannot be changed in Cyrus ? */
|
||||
return [NSString stringWithFormat: @"folder%@", inboxFolderName];
|
||||
return inboxFolderName;
|
||||
}
|
||||
|
||||
- (NSString *) _userFolderNameWithPurpose: (NSString *) purpose
|
||||
|
@ -380,13 +335,13 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
if (!folderName)
|
||||
folderName = draftsFolderName;
|
||||
|
||||
return [NSString stringWithFormat: @"folder%@", folderName];
|
||||
return folderName;
|
||||
}
|
||||
|
||||
- (NSString *) sieveFolderNameInContext: (id) _ctx
|
||||
{
|
||||
return [NSString stringWithFormat: @"folder%@", sieveFolderName];
|
||||
}
|
||||
// - (NSString *) sieveFolderNameInContext: (id) _ctx
|
||||
// {
|
||||
// return sieveFolderName;
|
||||
// }
|
||||
|
||||
- (NSString *) sentFolderNameInContext: (id)_ctx
|
||||
{
|
||||
|
@ -396,7 +351,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
if (!folderName)
|
||||
folderName = sentFolderName;
|
||||
|
||||
return [NSString stringWithFormat: @"folder%@", folderName];
|
||||
return folderName;
|
||||
}
|
||||
|
||||
- (NSString *) trashFolderNameInContext: (id)_ctx
|
||||
|
@ -407,7 +362,38 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
if (!folderName)
|
||||
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
|
||||
|
@ -415,8 +401,9 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
// TODO: use some profile to determine real location, use a -traverse lookup
|
||||
if (!inboxFolder)
|
||||
{
|
||||
inboxFolder = [self lookupName: [self inboxFolderNameInContext: _ctx]
|
||||
inContext: _ctx acquire: NO];
|
||||
inboxFolder
|
||||
= [self folderWithTraversal: [self inboxFolderNameInContext: _ctx]
|
||||
andClassName: nil];
|
||||
[inboxFolder retain];
|
||||
}
|
||||
|
||||
|
@ -430,43 +417,36 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default
|
|||
if (!draftsFolder)
|
||||
{
|
||||
draftsFolder
|
||||
= [self lookupName: [self draftsFolderNameInContext:_ctx]
|
||||
inContext: _ctx acquire: NO];
|
||||
// if (![draftsFolder isNotNull])
|
||||
// draftsFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
|
||||
// reason: @"did not find Drafts folder!"];
|
||||
= [self folderWithTraversal: [self draftsFolderNameInContext: _ctx]
|
||||
andClassName: @"SOGoDraftsFolder"];
|
||||
[draftsFolder retain];
|
||||
}
|
||||
|
||||
return draftsFolder;
|
||||
}
|
||||
|
||||
- (SOGoMailFolder *) sentFolderInContext: (id) _ctx
|
||||
- (SOGoSentFolder *) sentFolderInContext: (id) _ctx
|
||||
{
|
||||
// TODO: use some profile to determine real location, use a -traverse lookup
|
||||
|
||||
if (!sentFolder)
|
||||
{
|
||||
sentFolder = [self lookupName: [self sentFolderNameInContext:_ctx]
|
||||
inContext: _ctx acquire: NO];
|
||||
// if (![sentFolder isNotNull])
|
||||
// sentFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
|
||||
// reason: @"did not find Sent folder!"];
|
||||
sentFolder
|
||||
= [self folderWithTraversal: [self sentFolderNameInContext: _ctx]
|
||||
andClassName: @"SOGoSentFolder"];
|
||||
[sentFolder retain];
|
||||
}
|
||||
|
||||
return sentFolder;
|
||||
}
|
||||
|
||||
- (SOGoMailFolder *) trashFolderInContext: (id) _ctx
|
||||
- (SOGoTrashFolder *) trashFolderInContext: (id) _ctx
|
||||
{
|
||||
if (!trashFolder)
|
||||
{
|
||||
trashFolder = [self lookupName: [self trashFolderNameInContext: _ctx]
|
||||
inContext: _ctx acquire: NO];
|
||||
// if (![trashFolder isNotNull])
|
||||
// trashFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
|
||||
// reason: @"did not find Trash folder!"];
|
||||
trashFolder
|
||||
= [self folderWithTraversal: [self trashFolderNameInContext: _ctx]
|
||||
andClassName: @"SOGoTrashFolder"];
|
||||
[trashFolder retain];
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,10 @@ static BOOL debugOn = YES;
|
|||
NSMutableString *currentTraversal;
|
||||
|
||||
currentTraversal = [container traversalFromMailAccount];
|
||||
[currentTraversal appendFormat: @"/%@", [self relativeImap4Name]];
|
||||
if ([container isKindOfClass: [SOGoMailAccount class]])
|
||||
[currentTraversal appendString: [self relativeImap4Name]];
|
||||
else
|
||||
[currentTraversal appendFormat: @"/%@", [self relativeImap4Name]];
|
||||
|
||||
return currentTraversal;
|
||||
}
|
||||
|
|
|
@ -299,10 +299,34 @@ static NSString *defaultUserID = @"anyone";
|
|||
inContext: (id)_ctx
|
||||
acquire: (BOOL) _acquire
|
||||
{
|
||||
NSString *folderName, *className;
|
||||
SOGoMailAccount *mailAccount;
|
||||
id obj;
|
||||
|
||||
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
|
||||
{
|
||||
if ([[self imap4Connection] doesMailboxExistAtURL: [self imap4URL]])
|
||||
|
@ -394,22 +418,24 @@ static NSString *defaultUserID = @"anyone";
|
|||
{
|
||||
// TODO: detect Trash/Sent/Drafts folders
|
||||
SOGoMailAccount *account;
|
||||
NSString *n;
|
||||
NSString *name;
|
||||
|
||||
if (folderType != nil)
|
||||
return folderType;
|
||||
|
||||
account = [self mailAccountFolder];
|
||||
n = nameInContainer;
|
||||
if (!folderType)
|
||||
{
|
||||
account = [self mailAccountFolder];
|
||||
name = [self traversalFromMailAccount];
|
||||
|
||||
if ([n isEqualToString:[account trashFolderNameInContext:nil]])
|
||||
folderType = @"IPF.Trash";
|
||||
else if ([n isEqualToString:[account inboxFolderNameInContext:nil]])
|
||||
folderType = @"IPF.Inbox";
|
||||
else if ([n isEqualToString:[account sentFolderNameInContext:nil]])
|
||||
folderType = @"IPF.Sent";
|
||||
else
|
||||
folderType = @"IPF.Folder";
|
||||
if ([name isEqualToString: [account trashFolderNameInContext: nil]])
|
||||
folderType = @"IPF.Trash";
|
||||
else if ([name
|
||||
isEqualToString: [account inboxFolderNameInContext: nil]])
|
||||
folderType = @"IPF.Inbox";
|
||||
else if ([name
|
||||
isEqualToString: [account sentFolderNameInContext: nil]])
|
||||
folderType = @"IPF.Sent";
|
||||
else
|
||||
folderType = @"IPF.Folder";
|
||||
}
|
||||
|
||||
return folderType;
|
||||
}
|
||||
|
|
|
@ -216,7 +216,6 @@
|
|||
"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 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!";
|
||||
|
|
|
@ -217,7 +217,6 @@
|
|||
"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 root subfolder!" = "Vous devez choisir un sous-dossier de la racine.";
|
||||
|
||||
"Moving a message into its own folder is 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.";
|
||||
|
||||
"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!";
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
@interface UIxMailAccountActions : WODirectAction
|
||||
{
|
||||
NSString *draftFolderName;
|
||||
NSString *inboxFolderName;
|
||||
NSString *draftsFolderName;
|
||||
NSString *sentFolderName;
|
||||
NSString *trashFolderName;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#import <SoObjects/Mailer/SOGoMailAccount.h>
|
||||
#import <SoObjects/Mailer/SOGoDraftObject.h>
|
||||
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
|
||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
||||
#import <SoObjects/SOGo/NSString+Utilities.h>
|
||||
|
||||
|
@ -40,17 +41,56 @@
|
|||
|
||||
@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;
|
||||
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";
|
||||
else if ([baseName isEqualToString: draftFolderName])
|
||||
else if ([folderName isEqualToString: draftsFolderName])
|
||||
folderType = @"draft";
|
||||
else if ([baseName isEqualToString: sentFolderName])
|
||||
else if ([folderName isEqualToString: sentFolderName])
|
||||
folderType = @"sent";
|
||||
else if ([baseName isEqualToString: trashFolderName])
|
||||
else if ([folderName isEqualToString: trashFolderName])
|
||||
folderType = @"trash";
|
||||
else
|
||||
folderType = @"folder";
|
||||
|
@ -58,34 +98,20 @@
|
|||
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
|
||||
{
|
||||
NSMutableArray *folders;
|
||||
NSString *currentFolder;
|
||||
NSDictionary *folderData;
|
||||
|
||||
folders = [NSMutableArray array];
|
||||
|
||||
currentFolder = [rawFolders nextObject];
|
||||
while (currentFolder)
|
||||
while ((currentFolder = [rawFolders nextObject]))
|
||||
{
|
||||
[folders addObject: [self _lineForFolder: currentFolder]];
|
||||
currentFolder = [rawFolders nextObject];
|
||||
folderData = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
currentFolder, @"path",
|
||||
[self _folderType: currentFolder], @"type",
|
||||
nil];
|
||||
[folders addObject: folderData];
|
||||
}
|
||||
|
||||
return folders;
|
||||
|
@ -94,19 +120,14 @@
|
|||
- (WOResponse *) listMailboxesAction
|
||||
{
|
||||
SOGoMailAccount *co;
|
||||
NSArray *rawFolders, *folders;
|
||||
NSEnumerator *rawFolders;
|
||||
NSArray *folders;
|
||||
WOResponse *response;
|
||||
|
||||
co = [self clientObject];
|
||||
draftFolderName = [[co draftsFolderNameInContext: context]
|
||||
substringFromIndex: 6];
|
||||
sentFolderName = [[co sentFolderNameInContext: context]
|
||||
substringFromIndex: 6];
|
||||
trashFolderName = [[co trashFolderNameInContext: context]
|
||||
substringFromIndex: 6];
|
||||
|
||||
rawFolders = [co allFolderPaths];
|
||||
folders = [self _jsonFolders: [rawFolders objectEnumerator]];
|
||||
rawFolders = [[co allFolderPaths] objectEnumerator];
|
||||
folders = [self _jsonFolders: rawFolders];
|
||||
|
||||
response = [self responseWithStatus: 200];
|
||||
[response setHeader: @"text/plain; charset=utf-8"
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
trashFolderName
|
||||
= [[co mailAccountFolder] trashFolderNameInContext: context];
|
||||
path = [NSString stringWithFormat: @"/%@/%@",
|
||||
[trashFolderName substringFromIndex: 6], folderName];
|
||||
trashFolderName, folderName];
|
||||
destURL = [[NSURL alloc] initWithScheme: [srcURL scheme]
|
||||
host: [srcURL host] path: path];
|
||||
[destURL autorelease];
|
||||
|
@ -193,7 +193,7 @@
|
|||
[mailSettings autorelease];
|
||||
}
|
||||
[ud setObject: mailSettings forKey: @"Mail"];
|
||||
[mailSettings setObject: [co relativeImap4Name]
|
||||
[mailSettings setObject: [co traversalFromMailAccount]
|
||||
forKey: [NSString stringWithFormat: @"%@Folder",
|
||||
purpose]];
|
||||
[ud synchronize];
|
||||
|
|
|
@ -1393,13 +1393,8 @@ function _onMenuChangeToXXXFolder(event, folder) {
|
|||
window.alert(labels["You need to choose a non-virtual folder!"]);
|
||||
else {
|
||||
var folderID = document.menuTarget.getAttribute("dataname");
|
||||
var number = folderID.split("/").length;
|
||||
if (number > 3)
|
||||
window.alert(labels["You need to choose a root subfolder!"]);
|
||||
else {
|
||||
var urlstr = URLForFolderID(folderID) + "/setAs" + folder + "Folder";
|
||||
triggerAjaxRequest(urlstr, folderOperationCallback);
|
||||
}
|
||||
var urlstr = URLForFolderID(folderID) + "/setAs" + folder + "Folder";
|
||||
triggerAjaxRequest(urlstr, folderOperationCallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue