(feat) now possible to set a default Sieve filter (fixes #2949)
parent
dab18608c7
commit
eab6502d5a
|
@ -1892,6 +1892,11 @@ host.
|
|||
|
||||
Defaults to `NO` when unset.
|
||||
|
||||
|U |SOGoSieveFilters
|
||||
|Parameter used to define initial Sieve scripts for users. The user
|
||||
can still modify the scripts and the initial values will be written
|
||||
to the Sieve server upon first login.
|
||||
|
||||
|D |SOGoMailPollingIntervals
|
||||
|Parameter used to define the mail polling intervals (in minutes)
|
||||
available to the user. The parameter is an array that can contain the
|
||||
|
|
|
@ -34,11 +34,15 @@
|
|||
|
||||
#import <Appointments/SOGoFreeBusyObject.h>
|
||||
|
||||
#import <Mailer/SOGoMailAccount.h>
|
||||
#import <Mailer/SOGoMailAccounts.h>
|
||||
|
||||
#import <SOGo/SOGoCache.h>
|
||||
#import <SOGo/SOGoCASSession.h>
|
||||
#if defined(SAML2_CONFIG)
|
||||
#import <SOGo/SOGoSAML2Session.h>
|
||||
#endif
|
||||
#import <SOGo/SOGoDomainDefaults.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/SOGoWebAuthenticator.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
|
@ -66,10 +70,16 @@
|
|||
{
|
||||
SOGoUserFolder *co;
|
||||
NSString *loginModule;
|
||||
SOGoSystemDefaults *sd;
|
||||
SOGoDomainDefaults *dd;
|
||||
SOGoUserDefaults *ud;
|
||||
NSArray *filters;
|
||||
NSURL *moduleURL;
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
dd = [[context activeUser] domainDefaults];
|
||||
ud = [[context activeUser] userDefaults];
|
||||
|
||||
loginModule = [ud loginModule];
|
||||
if (!([loginModule isEqualToString: @"Calendar"]
|
||||
|| [loginModule isEqualToString: @"Contacts"]
|
||||
|
@ -80,6 +90,24 @@
|
|||
loginModule = @"Calendar";
|
||||
}
|
||||
|
||||
// We check if we must write the Sieve scripts to the server
|
||||
// upon first login if no user preferences are found, and the SOGo
|
||||
// admin has defined SOGoSieveFilters in the domain or system settings
|
||||
if ([dd sieveScriptsEnabled] && [[[ud source] values] count] == 0 &&
|
||||
((filters = [[dd source] objectForKey: @"SOGoSieveFilters"]) || (filters = [[sd source] objectForKey: @"SOGoSieveFilters"])))
|
||||
{
|
||||
SOGoMailAccount *account;
|
||||
SOGoMailAccounts *folder;
|
||||
|
||||
[ud setSieveFilters: filters];
|
||||
[ud synchronize];
|
||||
|
||||
folder = [[self clientObject] mailAccountsFolder: @"Mail"
|
||||
inContext: context];
|
||||
account = [folder lookupName: @"0" inContext: context acquire: NO];
|
||||
[account updateFilters];
|
||||
}
|
||||
|
||||
co = [self clientObject];
|
||||
moduleURL = [NSURL URLWithString: loginModule
|
||||
relativeToURL: [co soURL]];
|
||||
|
|
Loading…
Reference in New Issue