mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-04 09:59:44 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user