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:
Wolfgang Sourdeau
2012-08-15 18:59:42 +00:00
parent ab001192d6
commit 3f2cfd97e4
3 changed files with 35 additions and 1 deletions

View File

@@ -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