mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-24 07:32:44 +00:00
Monotone-Parent: 84ca160658d36fe85ed06cb0e19ed9f385489e47
Monotone-Revision: 288cd149fa53f2ec3619c4b4918b9f4752626301 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-11-10T22:53:57 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2006-11-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
|
||||
-moveToFolderNamed:folderNameinContext:]): new method base on
|
||||
-trashInContext:.
|
||||
|
||||
2006-11-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/generic.js: added and activated many
|
||||
|
||||
@@ -87,6 +87,8 @@
|
||||
|
||||
- (BOOL)isDeletionAllowed;
|
||||
- (NSException *)trashInContext:(id)_ctx;
|
||||
- (NSException *) moveToFolderNamed: (NSString *) folderName
|
||||
inContext: (id)_ctx;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -800,6 +800,71 @@ static BOOL debugSoParts = NO;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSException *) moveToFolderNamed: (NSString *) folderName
|
||||
inContext: (id)_ctx
|
||||
{
|
||||
/*
|
||||
Trashing is three actions:
|
||||
a) copy to trash folder
|
||||
b) mark mail as deleted
|
||||
c) expunge folder
|
||||
|
||||
In case b) or c) fails, we can't do anything because IMAP4 doesn't tell us
|
||||
the ID used in the trash folder.
|
||||
*/
|
||||
SOGoMailFolder *destFolder;
|
||||
NSEnumerator *folders;
|
||||
NSString *currentFolderName, *reason;
|
||||
NSException *error;
|
||||
|
||||
// TODO: check for safe HTTP method
|
||||
|
||||
destFolder = [self mailAccountsFolder];
|
||||
folders = [[folderName componentsSeparatedByString: @"/"] objectEnumerator];
|
||||
currentFolderName = [folders nextObject];
|
||||
currentFolderName = [folders nextObject];
|
||||
|
||||
while (currentFolderName)
|
||||
{
|
||||
destFolder = [destFolder lookupName: currentFolderName
|
||||
inContext: _ctx
|
||||
acquire: NO];
|
||||
if ([destFolder isKindOfClass: [NSException class]])
|
||||
return (NSException *) destFolder;
|
||||
currentFolderName = [folders nextObject];
|
||||
}
|
||||
|
||||
if (!([destFolder isKindOfClass: [SOGoMailFolder class]]
|
||||
&& [destFolder isNotNull]))
|
||||
{
|
||||
reason = [NSString stringWithFormat: @"Did not find folder name '%@'!",
|
||||
folderName];
|
||||
return [NSException exceptionWithHTTPStatus:500 /* Server Error */
|
||||
reason: reason];
|
||||
}
|
||||
[destFolder flushMailCaches];
|
||||
|
||||
/* a) copy */
|
||||
|
||||
error = [self davCopyToTargetObject: destFolder
|
||||
newName:@"fakeNewUnusedByIMAP4" /* autoassigned */
|
||||
inContext:_ctx];
|
||||
if (error != nil) return error;
|
||||
|
||||
/* b) mark deleted */
|
||||
|
||||
error = [[self imap4Connection] markURLDeleted: [self imap4URL]];
|
||||
if (error != nil) return error;
|
||||
|
||||
/* c) expunge */
|
||||
|
||||
error = [[self imap4Connection] expungeAtURL:[[self container] imap4URL]];
|
||||
if (error != nil) return error; // TODO: unflag as deleted?
|
||||
[self flushMailCaches];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSException *)delete {
|
||||
/*
|
||||
Note: delete is different to DELETEAction: for mails! The 'delete' runs
|
||||
|
||||
Reference in New Issue
Block a user