Monotone-Parent: 107e4e5ebd41e916769f1be7ce070d725d255f0d
Monotone-Revision: 2180e9f83acd350f77772f161695cca6bff102ec Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-08-15T18:59:42 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
ab001192d6
commit
3f2cfd97e4
|
@ -1,5 +1,10 @@
|
|||
2012-08-15 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreMailContext.m (-updateURLWithFolderName):
|
||||
change the folder name used in the context url to use the new
|
||||
folder name after a rename operation, so that further invocations
|
||||
of -url will return the right url.
|
||||
|
||||
* OpenChange/MAPIStoreMailFolder.m
|
||||
(-moveCopyToFolder:withNewName:isMove:isRecursive:): implemented
|
||||
IMAP-based copy operation, for speed.
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#import "MAPIStoreContext.h"
|
||||
|
||||
@interface MAPIStoreMailContext : MAPIStoreContext
|
||||
|
||||
- (void) updateURLWithFolderName: (NSString *) newFolderName;
|
||||
|
||||
@end
|
||||
|
||||
@interface MAPIStoreOutboxContext : MAPIStoreMailContext
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <Mailer/SOGoMailAccount.h>
|
||||
#import <Mailer/SOGoMailFolder.h>
|
||||
|
||||
|
@ -203,6 +204,31 @@ MakeDisplayFolderName (NSString *folderName)
|
|||
return [[userContext rootFolders] objectForKey: @"mail"];
|
||||
}
|
||||
|
||||
- (void) updateURLWithFolderName: (NSString *) newFolderName
|
||||
{
|
||||
NSString *urlString;
|
||||
NSMutableArray *pathComponents;
|
||||
BOOL hasSlash;
|
||||
NSUInteger max, folderNameIdx;
|
||||
NSURL *newURL;
|
||||
|
||||
urlString = [contextUrl absoluteString];
|
||||
hasSlash = [urlString hasSuffix: @"/"];
|
||||
pathComponents = [[urlString componentsSeparatedByString: @"/"]
|
||||
mutableCopy];
|
||||
[pathComponents autorelease];
|
||||
max = [pathComponents count];
|
||||
if (hasSlash)
|
||||
folderNameIdx = max - 2;
|
||||
else
|
||||
folderNameIdx = max - 1;
|
||||
[pathComponents replaceObjectAtIndex: folderNameIdx
|
||||
withObject: [newFolderName stringByEscapingURL]];
|
||||
urlString = [pathComponents componentsJoinedByString: @"/"];
|
||||
newURL = [NSURL URLWithString: urlString];
|
||||
ASSIGN (contextUrl, newURL);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStoreOutboxContext
|
||||
|
|
Loading…
Reference in a new issue