Monotone-Parent: 9bec05d8cd20a1e980c6381c10c71a9e57b984e6

Monotone-Revision: 4012894fc79b7641cebac42647c13996d86e9eca

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-01-30T20:47:07
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2012-01-30 20:47:07 +00:00
parent 98c9f995c8
commit 3bb6a1b975
3 changed files with 55 additions and 54 deletions
+2 -2
View File
@@ -86,6 +86,8 @@
- (NSException *) expunge;
- (NSException *) renameTo: (NSString *) newName;
- (NSCalendarDate *) mostRecentMessageDate;
/* flags */
@@ -94,8 +96,6 @@
/* folder type */
- (NSString *) outlookFolderClass;
- (NSArray *) subfolders;
- (BOOL) isSpecialFolder;
+47
View File
@@ -267,6 +267,53 @@ static NSString *defaultUserID = @"anyone";
return filenames;
}
- (NSException *) renameTo: (NSString *) newName
{
NSException *error;
SOGoMailFolder *inbox;
NSURL *destURL;
NSString *path;
NGImap4Client *client;
if ([newName length] > 0)
{
[self imap4URL];
[self imap4Connection];
client = [imap4 client];
inbox = [[self mailAccountFolder] inboxFolderInContext: context];
[client select: [inbox absoluteImap4Name]];
path = [[imap4URL path] stringByDeletingLastPathComponent];
if (![path hasSuffix: @"/"])
path = [path stringByAppendingString: @"/"];
destURL = [[NSURL alloc] initWithScheme: [imap4URL scheme]
host: [imap4URL host]
path: [NSString stringWithFormat: @"%@%@",
path, newName]];
[destURL autorelease];
error = [imap4 moveMailboxAtURL: imap4URL
toURL: destURL];
if (!error)
{
// We unsubscribe to the old one, and subscribe back to the new one
if ([[[context activeUser] userDefaults]
mailShowSubscribedFoldersOnly])
{
[client subscribe: [destURL path]];
[client unsubscribe: [imap4URL path]];
}
}
}
else
error = [NSException exceptionWithName: @"SOGoMailException"
reason: @"given name is empty"
userInfo: nil];
return error;
}
/* messages */
- (void) prefetchCoreInfosForMessageKeys: (NSArray *) keys
{