Monotone-Parent: 1e445a759baf03865aad01318b01c32c1c83c456

Monotone-Revision: 76b80b70d982a6797653b57df9258fed33df4bd9

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-10-26T14:26:01
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-10-26 14:26:01 +00:00
parent 127599b7ff
commit 941605d08f
5 changed files with 71 additions and 2 deletions
+3
View File
@@ -52,6 +52,9 @@
- (NSException *) postData: (NSData *) _data flags: (id) _flags;
- (void) markForExpunge;
- (void) expungeLastMarkedFolder;
- (NSException *) expunge;
/* flags */
+44
View File
@@ -19,9 +19,12 @@
02111-1307, USA.
*/
#import <Foundation/NSDictionary.h>
#import <Foundation/NSURL.h>
#import <Foundation/NSUserDefaults.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSURL+misc.h>
#import <NGExtensions/NSObject+Logs.h>
@@ -236,6 +239,47 @@ static NSString *defaultUserID = @"anyone";
return [[self imap4Connection] expungeAtURL: [self imap4URL]];
}
- (void) markForExpunge
{
NSUserDefaults *ud;
NSMutableDictionary *mailSettings;
ud = [[context activeUser] userSettings];
mailSettings = [ud objectForKey: @"Mail"];
if (!mailSettings)
{
mailSettings = [NSMutableDictionary dictionaryWithCapacity: 1];
[ud setObject: mailSettings forKey: @"Mail"];
}
[mailSettings setObject: [self imap4URLString] forKey: @"folderForExpunge"];
[ud synchronize];
}
- (void) expungeLastMarkedFolder
{
NSUserDefaults *ud;
NSMutableDictionary *mailSettings;
NSString *expungeURL;
NSURL *folderURL;
ud = [[context activeUser] userSettings];
mailSettings = [ud objectForKey: @"Mail"];
if (mailSettings)
{
expungeURL = [mailSettings objectForKey: @"folderForExpunge"];
if (expungeURL)
{
folderURL = [NSURL URLWithString: expungeURL];
if (![[self imap4Connection] expungeAtURL: folderURL])
{
[mailSettings removeObjectForKey: @"folderForExpunge"];
[ud synchronize];
}
}
}
}
/* flags */
- (NSException *) addFlagsToAllMessages: (id) _f
+3 -1
View File
@@ -874,7 +874,9 @@ static BOOL debugSoParts = NO;
error = [[self imap4Connection] markURLDeleted: [self imap4URL]];
if (error != nil) return error;
[container markForExpunge];
[self flushMailCaches];
return nil;