Monotone-Parent: 36de46e421cb49879d5821734892284e4035c708
Monotone-Revision: 73b3e5e425401db9c7ad2fc28660a6447ad0c4a5 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-09-17T20:27:46 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
52bcec0fea
commit
032a99adf2
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
* UI/MailerUI/UIxMailAccountActions.m ([WOResponse
|
* UI/MailerUI/UIxMailAccountActions.m ([WOResponse
|
||||||
-listMailboxesAction]): also returns the inbox quota, wrapped in a
|
-listMailboxesAction]): also returns the inbox quota, wrapped in a
|
||||||
new dictionary with keys "mailboxes" and "quotas".
|
new dictionary with keys "mailboxes" and "quotas". Uses the new user
|
||||||
|
default "SOGoSoftQuota" to force a quota and ignore the one
|
||||||
|
returned by the IMAP server.
|
||||||
|
|
||||||
2008-09-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2008-09-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSEnumerator.h>
|
#import <Foundation/NSEnumerator.h>
|
||||||
|
#import <Foundation/NSUserDefaults.h>
|
||||||
|
|
||||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||||
#import <NGObjWeb/WORequest.h>
|
#import <NGObjWeb/WORequest.h>
|
||||||
|
@ -122,7 +123,7 @@
|
||||||
|
|
||||||
- (WOResponse *) listMailboxesAction
|
- (WOResponse *) listMailboxesAction
|
||||||
{
|
{
|
||||||
id infos;
|
id infos, inboxQuota;
|
||||||
SOGoMailAccount *co;
|
SOGoMailAccount *co;
|
||||||
SOGoMailFolder *inbox;
|
SOGoMailFolder *inbox;
|
||||||
NGImap4Client *client;
|
NGImap4Client *client;
|
||||||
|
@ -130,21 +131,31 @@
|
||||||
NSArray *folders;
|
NSArray *folders;
|
||||||
NSDictionary *data;
|
NSDictionary *data;
|
||||||
NSString *inboxName;
|
NSString *inboxName;
|
||||||
|
NSUserDefaults *ud;
|
||||||
WOResponse *response;
|
WOResponse *response;
|
||||||
|
int quota;
|
||||||
|
|
||||||
|
ud = [NSUserDefaults standardUserDefaults];
|
||||||
co = [self clientObject];
|
co = [self clientObject];
|
||||||
|
|
||||||
rawFolders = [[co allFolderPaths] objectEnumerator];
|
rawFolders = [[co allFolderPaths] objectEnumerator];
|
||||||
folders = [self _jsonFolders: rawFolders];
|
folders = [self _jsonFolders: rawFolders];
|
||||||
|
|
||||||
// Retrieve INBOX quota
|
// Retrieve INBOX quota
|
||||||
|
quota = [ud integerForKey: @"SOGoSoftQuota"];
|
||||||
inbox = [co inboxFolderInContext: context];
|
inbox = [co inboxFolderInContext: context];
|
||||||
inboxName = [NSString stringWithFormat: @"/%@", [inbox relativeImap4Name]];
|
inboxName = [NSString stringWithFormat: @"/%@", [inbox relativeImap4Name]];
|
||||||
client = [[inbox imap4Connection] client];
|
client = [[inbox imap4Connection] client];
|
||||||
infos = [client getQuotaRoot: [inbox relativeImap4Name]];
|
infos = [[client getQuotaRoot: [inbox relativeImap4Name]] objectForKey: @"quotas"];
|
||||||
|
inboxQuota = [infos objectForKey: inboxName];
|
||||||
|
if (quota > 0 && inboxQuota != nil)
|
||||||
|
// A soft quota is imposed for all users
|
||||||
|
inboxQuota = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
|
[NSNumber numberWithInt: quota], @"maxQuota",
|
||||||
|
[inboxQuota objectForKey: @"usedSpace"], @"usedSpace",
|
||||||
|
nil];
|
||||||
data = [NSDictionary dictionaryWithObjectsAndKeys: folders, @"mailboxes",
|
data = [NSDictionary dictionaryWithObjectsAndKeys: folders, @"mailboxes",
|
||||||
[[infos objectForKey: @"quotas"] objectForKey: inboxName], @"quotas",
|
inboxQuota, @"quotas",
|
||||||
nil];
|
nil];
|
||||||
response = [self responseWithStatus: 200];
|
response = [self responseWithStatus: 200];
|
||||||
[response setHeader: @"text/plain; charset=utf-8"
|
[response setHeader: @"text/plain; charset=utf-8"
|
||||||
|
|
Loading…
Reference in a new issue