Specify a custom vacation subject

User can now specify a custom vacation subject. For Sieve servers
implementing the variables extension, one can write ${subject} to insert
the original subject in the auto reply.

SOGoDefaultVacationSubject is a new domain defaults parameter used when
the user doesn't specify a custom subject.

Fixes #685, #1447
This commit is contained in:
Francis Lachapelle
2016-06-15 16:02:12 -04:00
parent 49ed5bb462
commit d8fc40217d
10 changed files with 91 additions and 14 deletions

View File

@@ -72,11 +72,11 @@ static SoProduct *preferencesProduct = nil;
- (WOResponse *) jsonDefaultsAction
{
NSMutableDictionary *values, *account;
NSMutableDictionary *values, *account, *vacation;
SOGoUserDefaults *defaults;
SOGoDomainDefaults *domainDefaults;
NSMutableArray *accounts;
NSDictionary *categoryLabels;
NSDictionary *categoryLabels, *vacationOptions;
NSDictionary *locale;
if (!preferencesProduct)
@@ -312,7 +312,7 @@ static SoProduct *preferencesProduct = nil;
values = [[[[defaults source] values] mutableCopy] autorelease];
//
// Expose additional information that must not be synchronized in the defaults
// Expose additional information that must *not* be synchronized in the defaults
//
// Expose the SOGoAppointmentSendEMailNotifications configuration parameter from the domain defaults
@@ -343,6 +343,18 @@ static SoProduct *preferencesProduct = nil;
[accounts insertObject: account atIndex: 0];
[values setObject: accounts forKey: @"AuxiliaryMailAccounts"];
// Add the domain's default vacation subject if user has not specified a custom subject
vacationOptions = [defaults vacationOptions];
if (![vacationOptions objectForKey: @"customSubject"] && [domainDefaults vacationDefaultSubject])
{
if (vacationOptions)
vacation = [NSMutableDictionary dictionaryWithDictionary: vacationOptions];
else
vacation = [NSMutableDictionary dictionary];
[vacation setObject: [domainDefaults vacationDefaultSubject] forKey: @"customSubject"];
[values setObject: vacation forKey: @"Vacation"];
}
return [self responseWithStatus: 200 andJSONRepresentation: values];
}