Added missing functions getClient and IsSieveServerConnected and the changes that comes with it

pull/22/head
Alexandre Cloutier 2014-03-10 10:33:27 -04:00
parent f4d189ffc8
commit f5faa60814
2 changed files with 29 additions and 12 deletions

View File

@ -22,6 +22,7 @@
#define UIXPREFERENCES_H
#import <SOGoUI/UIxComponent.h>
#import <NGImap4/NGSieveClient.h>
@class NSString;
@ -32,6 +33,7 @@
{
id item;
SOGoUser *user;
NGSieveClient *client;
// Calendar categories
NSString *category;
@ -58,6 +60,8 @@
}
- (NSString *) userLongDateFormat;
- (BOOL) isSieveServerAvailable;
- (id) getClient;
@end

View File

@ -114,6 +114,8 @@ static NSArray *reminderValues = nil;
if ((self = [super init]))
{
item = nil;
client = [self getClient];
#warning user should be the owner rather than the activeUser
ASSIGN (user, [context activeUser]);
ASSIGN (today, [NSCalendarDate date]);
@ -174,6 +176,7 @@ static NSArray *reminderValues = nil;
[contactsCategories release];
[forwardOptions release];
[daysOfWeek release];
[client release];
[super dealloc];
}
@ -840,26 +843,15 @@ static NSArray *reminderValues = nil;
- (NSString *) sieveCapabilities
{
#warning sieve caps should be deduced from the server
static NSArray *capabilities = nil;
SOGoMailAccounts *folder;
SOGoMailAccount *account;
SOGoSieveManager *manager;
NGSieveClient *client;
if (!capabilities)
{
folder = [[self clientObject] mailAccountsFolder: @"Mail"
inContext: context];
account = [folder lookupName: @"0" inContext: context acquire: NO];
manager = [SOGoSieveManager sieveManagerForUser: [context activeUser]];
client = [manager clientForAccount: account];
if (client)
capabilities = [client capabilities];
else
capabilities = [NSArray array];
[capabilities retain];
[capabilities retain];
}
return [capabilities jsonRepresentation];
@ -1137,6 +1129,27 @@ static NSArray *reminderValues = nil;
}
}
- (id) getClient{
SOGoMailAccount *account;
SOGoMailAccounts *folder;
SOGoSieveManager *manager;
NGSieveClient *realClient;
folder = [[self clientObject] mailAccountsFolder: @"Mail" inContext: context];
account = [folder lookupName: @"0" inContext: context acquire: NO];
manager = [SOGoSieveManager sieveManagerForUser: [context activeUser]];
realClient = [manager clientForAccount: account];
return realClient;
}
- (BOOL) isSieveServerAvailable {
return (([client isConnected])
? true
: false);
}
- (id <WOActionResults>) defaultAction
{
id <WOActionResults> results;