mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-21 22:53:18 +00:00
Fixed bug #1944
Deleting a mail folder doesn't create the Trash mailbox.
This commit is contained in:
@@ -86,6 +86,8 @@
|
|||||||
|
|
||||||
- (BOOL) create;
|
- (BOOL) create;
|
||||||
|
|
||||||
|
- (BOOL) ensureTrashFolder;
|
||||||
|
|
||||||
- (NSException *) expunge;
|
- (NSException *) expunge;
|
||||||
|
|
||||||
- (NSException *) renameTo: (NSString *) newName;
|
- (NSException *) renameTo: (NSString *) newName;
|
||||||
|
|||||||
@@ -414,17 +414,15 @@ static NSString *defaultUserID = @"anyone";
|
|||||||
{
|
{
|
||||||
// If our Trash folder doesn't exist when we try to copy messages
|
// If our Trash folder doesn't exist when we try to copy messages
|
||||||
// to it, we create it.
|
// to it, we create it.
|
||||||
result = [[client status: folderName flags: [NSArray arrayWithObject: @"UIDVALIDITY"]]
|
b = [self ensureTrashFolder];
|
||||||
objectForKey: @"result"];
|
|
||||||
|
|
||||||
if (![result boolValue])
|
if (b)
|
||||||
[imap4 createMailbox: folderName
|
{
|
||||||
atURL: [[self mailAccountFolder] imap4URL]];
|
result = [[client copyUids: uids toFolder: folderName]
|
||||||
|
objectForKey: @"result"];
|
||||||
|
|
||||||
result = [[client copyUids: uids toFolder: folderName]
|
b = [result boolValue];
|
||||||
objectForKey: @"result"];
|
}
|
||||||
|
|
||||||
b = [result boolValue];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -956,6 +954,24 @@ static NSString *defaultUserID = @"anyone";
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) ensureTrashFolder
|
||||||
|
{
|
||||||
|
SOGoMailFolder *trashFolder;
|
||||||
|
BOOL rc;
|
||||||
|
|
||||||
|
trashFolder = [[self mailAccountFolder] trashFolderInContext: context];
|
||||||
|
rc = NO;
|
||||||
|
if (![trashFolder isKindOfClass: [NSException class]])
|
||||||
|
{
|
||||||
|
rc = [trashFolder exists];
|
||||||
|
if (!rc)
|
||||||
|
rc = [trashFolder create];
|
||||||
|
}
|
||||||
|
if (!rc)
|
||||||
|
[self errorWithFormat: @"Cannot create Trash Mailbox"];
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSException *) delete
|
- (NSException *) delete
|
||||||
{
|
{
|
||||||
NSException *error;
|
NSException *error;
|
||||||
|
|||||||
@@ -153,26 +153,34 @@
|
|||||||
NSURL *srcURL, *destURL;
|
NSURL *srcURL, *destURL;
|
||||||
|
|
||||||
co = [self clientObject];
|
co = [self clientObject];
|
||||||
connection = [co imap4Connection];
|
if ([co ensureTrashFolder])
|
||||||
srcURL = [co imap4URL];
|
{
|
||||||
destURL = [self _trashedURLOfFolder: srcURL withCO: co];
|
connection = [co imap4Connection];
|
||||||
connection = [co imap4Connection];
|
srcURL = [co imap4URL];
|
||||||
inbox = [[co mailAccountFolder] inboxFolderInContext: context];
|
destURL = [self _trashedURLOfFolder: srcURL withCO: co];
|
||||||
[[connection client] select: [inbox absoluteImap4Name]];
|
connection = [co imap4Connection];
|
||||||
error = [connection moveMailboxAtURL: srcURL toURL: destURL];
|
inbox = [[co mailAccountFolder] inboxFolderInContext: context];
|
||||||
if (error)
|
[[connection client] select: [inbox absoluteImap4Name]];
|
||||||
{
|
error = [connection moveMailboxAtURL: srcURL toURL: destURL];
|
||||||
response = [self responseWithStatus: 500];
|
if (error)
|
||||||
[response appendContentString: @"Unable to move folder."];
|
{
|
||||||
}
|
response = [self responseWithStatus: 500];
|
||||||
|
[response appendContentString: @"Unable to move folder."];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We unsubscribe to the old one, and subscribe back to the new one
|
||||||
|
[[connection client] subscribe: [destURL path]];
|
||||||
|
[[connection client] unsubscribe: [srcURL path]];
|
||||||
|
|
||||||
|
response = [self responseWith204];
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We unsubscribe to the old one, and subscribe back to the new one
|
response = [self responseWithStatus: 500];
|
||||||
[[connection client] subscribe: [destURL path]];
|
[response appendContentString: @"Unable to move folder."];
|
||||||
[[connection client] unsubscribe: [srcURL path]];
|
}
|
||||||
|
|
||||||
response = [self responseWith204];
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user