#include "SOGoMailObject.h"
#include "SOGoMailFolder.h"
+#include "SOGoMailAccount.h"
#include "SOGoMailManager.h"
#include "SOGoMailBodyPart.h"
#include <NGImap4/NGImap4Envelope.h>
/* operations */
+- (NSException *)trashAction:(id)_ctx {
+ SOGoMailFolder *trashFolder;
+ NSException *error;
+
+ // TODO: check for safe HTTP method
+
+ trashFolder = [[self mailAccountFolder] trashFolderInContext:_ctx];
+ if ([trashFolder isKindOfClass:[NSException class]])
+ return (NSException *)trashFolder;
+ if (![trashFolder isNotNull]) {
+ return [NSException exceptionWithHTTPStatus:500 /* Server Error */
+ reason:@"Did not find Trash folder!"];
+ }
+
+ error = [self davCopyToTargetObject:trashFolder newName:nil inContext:_ctx];
+ if (error != nil) return error;
+
+ return nil;
+}
+
- (NSException *)delete {
/*
Note: delete is different to DELETEAction: for mails! The 'delete' runs
*/
// TODO: copy to Trash folder
NSException *error;
+
+ // TODO: check for safe HTTP method
error = [[self mailManager] markURLDeleted:[self imap4URL]
password:[self imap4Password]];
- (id)DELETEAction:(id)_ctx {
NSException *error;
+ // TODO: ensure safe HTTP method
+
error = [[self mailManager] markURLDeleted:[self imap4URL]
password:[self imap4Password]];
if (error != nil) return error;