Expunge mailbox on specific actions

Current mailbox is now expunged when leaving the Mail module. The drafts
mailbox is also expunged when a message is sent.
This commit is contained in:
Francis Lachapelle
2016-07-27 11:56:28 -04:00
parent f1d2bcffc8
commit 80338daf91
3 changed files with 27 additions and 6 deletions
+12 -3
View File
@@ -1,5 +1,5 @@
/*
Copyright (C) 2007-2014 Inverse inc.
Copyright (C) 2007-2016 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo.
@@ -63,6 +63,7 @@
#import "NSData+Mail.h"
#import "NSString+Mail.h"
#import "SOGoDraftsFolder.h"
#import "SOGoMailAccount.h"
#import "SOGoMailObject+Draft.h"
#import "SOGoSentFolder.h"
@@ -1970,8 +1971,16 @@ static NSString *userAgent = nil;
}
}
if (!error && ![dd mailKeepDraftsAfterSend])
[self delete];
// Expunge Drafts mailbox if
// - message was sent and saved to Sent mailbox if necessary;
// - SOGoMailKeepDraftsAfterSend is not set;
// - draft is successfully deleted;
// - drafts mailbox exists.
if (!error &&
![dd mailKeepDraftsAfterSend] &&
![self delete] &&
[imap4 doesMailboxExistAtURL: [container imap4URL]])
[(SOGoDraftsFolder *) container expunge];
return error;
}