From c6b8cb5a1cacfc72662845f38b01f5f340c566bb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 1 Feb 2008 16:28:53 +0000 Subject: [PATCH] Monotone-Parent: 0bf13271077dfd22aaca8a2663fe7490f9d84cb3 Monotone-Revision: a216f87669942e793f9124b63661a5ae82105c1d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-02-01T16:28:53 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 ++++++++ SoObjects/Mailer/SOGoMailAccount.h | 2 ++ SoObjects/Mailer/SOGoMailAccount.m | 11 ++++++++ SoObjects/Mailer/SOGoMailAccounts.h | 2 ++ SoObjects/Mailer/SOGoMailAccounts.m | 1 + UI/MailerUI/UIxMailMainFrame.m | 29 +++++++++++++++++++++- UI/Templates/MailerUI/UIxMailMainFrame.wox | 1 + UI/WebServerResources/MailerUI.js | 23 ++++++++++++++--- 8 files changed, 74 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b492fefdf..f9f799d1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-02-01 Wolfgang Sourdeau + + * UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame + -quotaSupport]): new json string that lists the quota support + among the user's mail accounts. + + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -supportsQuotas]): new method that returns whether the current + account server has support for quotas. + 2008-01-29 Wolfgang Sourdeau * SoObjects/SOGo/SOGoGCSFolder.m ([SOGoGCSFolder diff --git a/SoObjects/Mailer/SOGoMailAccount.h b/SoObjects/Mailer/SOGoMailAccount.h index 8c720e1f1..e907d8cdb 100644 --- a/SoObjects/Mailer/SOGoMailAccount.h +++ b/SoObjects/Mailer/SOGoMailAccount.h @@ -48,6 +48,8 @@ SOGoTrashFolder *trashFolder; } +- (BOOL) supportsQuotas; + /* folder pathes */ - (NSArray *) allFolderPaths; diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 4f2f59110..8b3559860 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -31,6 +31,8 @@ #import #import #import +#import +#import #import #import @@ -170,6 +172,15 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default return folders; } +- (BOOL) supportsQuotas +{ + NGImap4Client *imapClient; + + imapClient = [[self imap4Connection] client]; + + return [[imapClient context] canQuota]; +} + /* hierarchy */ - (SOGoMailAccount *) mailAccountFolder diff --git a/SoObjects/Mailer/SOGoMailAccounts.h b/SoObjects/Mailer/SOGoMailAccounts.h index 623ffcb2f..afd7404cd 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.h +++ b/SoObjects/Mailer/SOGoMailAccounts.h @@ -41,6 +41,8 @@ @interface SOGoMailAccounts : SOGoFolder +- (NSArray *) toManyRelationshipKeys; + @end #endif /* __Mailer_SOGoMailAccounts_H__ */ diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index 515c66523..3188052ca 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -76,6 +76,7 @@ static NSString *AgenorShareLoginMarker = @".-."; } ct = [[ctClass alloc] initWithName:_key inContainer:self]; + return [ct autorelease]; } diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index e45d9d301..10e0a8f06 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -20,6 +20,7 @@ */ #import +#import #import #import @@ -28,6 +29,7 @@ #import #import +#import #import #import #import @@ -71,6 +73,29 @@ return [accountNames jsonRepresentation]; } +- (NSString *) quotaSupport +{ + NSEnumerator *accountNames; + NSMutableArray *quotas; + NSString *currentAccount; + SOGoMailAccounts *co; + BOOL supportsQuota; + + co = [self clientObject]; + accountNames = [[co toManyRelationshipKeys] objectEnumerator]; + + quotas = [NSMutableArray array]; + while ((currentAccount = [accountNames nextObject])) + { + supportsQuota = [[co lookupName: currentAccount + inContext: context + acquire: NO] supportsQuotas]; + [quotas addObject: [NSNumber numberWithInt: supportsQuota]]; + } + + return [quotas jsonRepresentation]; +} + - (NSString *) pageFormURL { NSString *u; @@ -127,7 +152,9 @@ accounts = [[context activeUser] mailAccounts]; firstAccount = [[accounts objectsForKey: @"name"] objectAtIndex: 0]; formValues = [[context request] formValues]; - parameters = [formValues count] > 0 ? [formValues asURLParameters] : @"?mailto="; + parameters = ([formValues count] > 0 + ? [formValues asURLParameters] + : @"?mailto="); newLocation = [NSString stringWithFormat: @"%@/%@/compose%@", [co baseURLInContext: context], firstAccount, diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index 355c89998..cd847feba 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -10,6 +10,7 @@ const:jsFiles="dtree.js,MailerUI+dTree.js">