mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-21 06:52:40 +00:00
Monotone-Parent: 0d7ec7c80044ea713be016f5438ae7893c4ef140
Monotone-Revision: 65abf28d09d0ab2a977e4b818473c959e2670132 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-10-17T21:03:39 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
eab8fb4f40
commit
901304d722
9 files changed
+251
-44
No files matched your search
@@ -24,8 +24,10 @@
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGImap4/NGImap4Connection.h>
|
||||
@@ -35,6 +37,7 @@
|
||||
#import <SoObjects/Mailer/SOGoTrashFolder.h>
|
||||
#import <SoObjects/Mailer/SOGoMailAccount.h>
|
||||
#import <SoObjects/SOGo/NSObject+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
|
||||
#import <UI/Common/WODirectAction+SOGo.h>
|
||||
|
||||
@@ -172,6 +175,55 @@
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WOResponse *) _setFolderPurpose: (NSString *) purpose
|
||||
{
|
||||
SOGoMailFolder *co;
|
||||
WOResponse *response;
|
||||
NSUserDefaults *ud;
|
||||
NSMutableDictionary *mailSettings;
|
||||
|
||||
co = [self clientObject];
|
||||
if ([NSStringFromClass ([co class]) isEqualToString: @"SOGoMailFolder"])
|
||||
{
|
||||
ud = [[context activeUser] userSettings];
|
||||
mailSettings = [ud objectForKey: @"Mail"];
|
||||
if (!mailSettings)
|
||||
{
|
||||
mailSettings = [NSMutableDictionary new];
|
||||
[mailSettings autorelease];
|
||||
}
|
||||
[ud setObject: mailSettings forKey: @"Mail"];
|
||||
[mailSettings setObject: [co relativeImap4Name]
|
||||
forKey: [NSString stringWithFormat: @"%@Folder",
|
||||
purpose]];
|
||||
[ud synchronize];
|
||||
response = [self responseWith204];
|
||||
}
|
||||
else
|
||||
{
|
||||
response = [self responseWithStatus: 500];
|
||||
[response
|
||||
appendContentString: @"Unable to change the purpose of this folder."];
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
- (WOResponse *) setAsDraftsFolderAction
|
||||
{
|
||||
return [self _setFolderPurpose: @"Drafts"];
|
||||
}
|
||||
|
||||
- (WOResponse *) setAsSentFolderAction
|
||||
{
|
||||
return [self _setFolderPurpose: @"Sent"];
|
||||
}
|
||||
|
||||
- (WOResponse *) setAsTrashFolderAction
|
||||
{
|
||||
return [self _setFolderPurpose: @"Trash"];
|
||||
}
|
||||
|
||||
- (WOResponse *) expungeAction
|
||||
{
|
||||
NSException *error;
|
||||
|
||||
Reference in new issue
Block a user