Added the possibility of retreiving the number of unseen

messages from the INBOX.

Monotone-Parent: 043af14fd2ae984a7c53179d03394ad062129d22
Monotone-Revision: 22a0204fbcb44500dd41a225b263a8be90401353

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2008-10-03T13:54:24
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2008-10-03 13:54:24 +00:00
parent 95f54c2c96
commit 4109cf5e27
3 changed files with 40 additions and 0 deletions

View File

@ -35,6 +35,7 @@
NSString *trashFolderName;
}
- (WOResponse *) statusFoldersAction;
- (WOResponse *) listMailboxesAction;
@end

View File

@ -122,6 +122,40 @@
return folders;
}
- (NSDictionary *) _statusFolders
{
SOGoMailFolder *inbox;
NGImap4Client *client;
SOGoMailAccount *co;
NSNumber *unseen;
co = [self clientObject];
inbox = [co inboxFolderInContext: context];
client = [[inbox imap4Connection] client];
unseen = [[client status: [inbox relativeImap4Name] flags: [NSArray arrayWithObject: @"UNSEEN"]]
objectForKey: @"unseen"];
if (!unseen)
unseen = [NSNumber numberWithInt: 0];
return [NSDictionary dictionaryWithObjectsAndKeys: unseen, @"unseen", nil];
}
- (WOResponse *) statusFoldersAction
{
WOResponse *response;
NSDictionary *data;
response = [self responseWithStatus: 200];
data = [self _statusFolders];
[response setHeader: @"text/plain; charset=utf-8"
forKey: @"content-type"];
[response appendContentString: [data jsonRepresentation]];
return response;
}
- (WOResponse *) listMailboxesAction
{
id infos, inboxQuota;

View File

@ -372,6 +372,11 @@
actionClass = "UIxMailFolderActions";
actionName = "createFolder";
};
statusFolders = {
protectedBy = "View";
actionClass = "UIxMailAccountActions";
actionName = "statusFolders";
};
};
};