Monotone-Parent: 13d32f10f777940ff2ce93d307d4211a335f0571

Monotone-Revision: 32ab392d3b7d226db707f5c0a95d358eb0d5d4de

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2008-10-09T17:53:57
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle 2008-10-09 17:53:57 +00:00
parent f2b761555b
commit 1378a588a3

View file

@ -32,6 +32,8 @@
#import <NGImap4/NGImap4Connection.h> #import <NGImap4/NGImap4Connection.h>
#import <NGImap4/NGImap4Client.h> #import <NGImap4/NGImap4Client.h>
#import <EOControl/EOQualifier.h>
#import <SoObjects/Mailer/SOGoMailAccount.h> #import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoDraftObject.h> #import <SoObjects/Mailer/SOGoDraftObject.h>
#import <SoObjects/Mailer/SOGoDraftsFolder.h> #import <SoObjects/Mailer/SOGoDraftsFolder.h>
@ -124,17 +126,26 @@
- (NSDictionary *) _statusFolders - (NSDictionary *) _statusFolders
{ {
SOGoMailFolder *inbox; EOQualifier *searchQualifier;
NSArray *searchResult;
NSDictionary *imapResult;
NGImap4Client *client; NGImap4Client *client;
SOGoMailAccount *co;
NSNumber *unseen; NSNumber *unseen;
SOGoMailFolder *inbox;
SOGoMailAccount *co;
co = [self clientObject]; co = [self clientObject];
inbox = [co inboxFolderInContext: context]; inbox = [co inboxFolderInContext: context];
client = [[inbox imap4Connection] client]; client = [[inbox imap4Connection] client];
unseen = [[client status: [inbox relativeImap4Name] flags: [NSArray arrayWithObject: @"UNSEEN"]]
objectForKey: @"unseen"];
if ([client select: [inbox relativeImap4Name]])
{
searchQualifier = [EOQualifier qualifierWithQualifierFormat: @"flags = %@ AND not flags = %@", @"unseen", @"deleted"];
imapResult = [client searchWithQualifier: searchQualifier];
searchResult = [[imapResult objectForKey: @"RawResponse"] objectForKey: @"search"];
unseen = [NSNumber numberWithInt: [searchResult count]];
}
if (!unseen) if (!unseen)
unseen = [NSNumber numberWithInt: 0]; unseen = [NSNumber numberWithInt: 0];
@ -193,6 +204,7 @@
nil]; nil];
} }
data = [NSDictionary dictionaryWithObjectsAndKeys: folders, @"mailboxes", data = [NSDictionary dictionaryWithObjectsAndKeys: folders, @"mailboxes",
[self _statusFolders], @"status",
inboxQuota, @"quotas", inboxQuota, @"quotas",
nil]; nil];
response = [self responseWithStatus: 200]; response = [self responseWithStatus: 200];