mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-22 07:14:21 +00:00
propagate from branch 'ca.inverse.sogo.1_3_12' (head 05f8b72feb6a6c81f20462457e2dbc6c47ae9edc)
to branch 'ca.inverse.sogo' (head dc4e3d958b052eb7529db6b61731e80df56ed412) Monotone-Parent: 05f8b72feb6a6c81f20462457e2dbc6c47ae9edc Monotone-Parent: dc4e3d958b052eb7529db6b61731e80df56ed412 Monotone-Revision: ba1ab7317c5e8c4b1e95d7e3f299bfd9ea38b10d Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-02-01T21:12:25 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
3c4fd611d8
134 files changed
+4671
-3239
No files matched your search
@@ -84,70 +84,24 @@
|
||||
return response;
|
||||
}
|
||||
|
||||
- (NSURL *) _urlOfFolder: (NSURL *) srcURL
|
||||
renamedTo: (NSString *) folderName
|
||||
{
|
||||
NSString *path;
|
||||
NSURL *destURL;
|
||||
|
||||
path = [[srcURL path] stringByDeletingLastPathComponent];
|
||||
if (![path hasSuffix: @"/"])
|
||||
path = [path stringByAppendingString: @"/"];
|
||||
|
||||
destURL = [[NSURL alloc] initWithScheme: [srcURL scheme]
|
||||
host: [srcURL host]
|
||||
path: [NSString stringWithFormat: @"%@%@",
|
||||
path, folderName]];
|
||||
[destURL autorelease];
|
||||
|
||||
return destURL;
|
||||
}
|
||||
|
||||
- (WOResponse *) renameFolderAction
|
||||
{
|
||||
SOGoMailFolder *co, *inbox;
|
||||
SOGoMailFolder *co;
|
||||
WOResponse *response;
|
||||
NGImap4Connection *connection;
|
||||
NSException *error;
|
||||
NSString *folderName;
|
||||
NSURL *srcURL, *destURL;
|
||||
|
||||
co = [self clientObject];
|
||||
|
||||
folderName = [[context request] formValueForKey: @"name"];
|
||||
if ([folderName length] > 0)
|
||||
{
|
||||
srcURL = [co imap4URL];
|
||||
destURL = [self _urlOfFolder: srcURL renamedTo: folderName];
|
||||
connection = [co imap4Connection];
|
||||
inbox = [[co mailAccountFolder] inboxFolderInContext: context];
|
||||
[[connection client] select: [inbox absoluteImap4Name]];
|
||||
error = [connection moveMailboxAtURL: srcURL
|
||||
toURL: destURL];
|
||||
|
||||
if (error)
|
||||
{
|
||||
response = [self responseWithStatus: 500];
|
||||
[response appendContentString: @"Unable to rename folder."];
|
||||
}
|
||||
else
|
||||
{
|
||||
// We unsubscribe to the old one, and subscribe back to the new one
|
||||
if ([[[context activeUser] userDefaults]
|
||||
mailShowSubscribedFoldersOnly])
|
||||
{
|
||||
[[connection client] subscribe: [destURL path]];
|
||||
[[connection client] unsubscribe: [srcURL path]];
|
||||
}
|
||||
|
||||
response = [self responseWith204];
|
||||
}
|
||||
}
|
||||
else
|
||||
error = [co renameTo: folderName];
|
||||
if (error)
|
||||
{
|
||||
response = [self responseWithStatus: 500];
|
||||
[response appendContentString: @"Missing 'name' parameter."];
|
||||
[response appendContentString: @"Unable to rename folder."];
|
||||
}
|
||||
else
|
||||
response = [self responseWith204];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user