diff --git a/NEWS b/NEWS index 621f5f3c3..723e367c0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +4.1.1 (2019-XX-XX) +------------------ + +New features + - + +Enhancements + - + +Bug fixes + - [core] use the supplied Sieve creds to fetch the IMAP4 separator (#4846) + + 4.1.0 (2019-10-24) ------------------ diff --git a/SoObjects/SOGo/SOGoSieveManager.h b/SoObjects/SOGo/SOGoSieveManager.h index 574490de4..05b9a8fe7 100644 --- a/SoObjects/SOGo/SOGoSieveManager.h +++ b/SoObjects/SOGo/SOGoSieveManager.h @@ -1,6 +1,6 @@ /* SOGoSieveManager.h - this file is part of SOGo * - * Copyright (C) 2010-2014 Inverse inc. + * Copyright (C) 2010-2019 Inverse inc. * * Author: Inverse * @@ -41,7 +41,8 @@ + (id) sieveManagerForUser: (SOGoUser *) user; - (id) initForUser: (SOGoUser *) newUser; -- (NSString *) sieveScriptWithRequirements: (NSMutableArray *) newRequirements; +- (NSString *) sieveScriptWithRequirements: (NSMutableArray *) newRequirements + delimiter: (NSString *) delimiter; - (NSString *) lastScriptError; - (NGSieveClient *) clientForAccount: (SOGoMailAccount *) theAccount; diff --git a/SoObjects/SOGo/SOGoSieveManager.m b/SoObjects/SOGo/SOGoSieveManager.m index 799a49dda..d7de49c20 100644 --- a/SoObjects/SOGo/SOGoSieveManager.m +++ b/SoObjects/SOGo/SOGoSieveManager.m @@ -32,6 +32,8 @@ #import #import +#import +#import #import #import "../Mailer/SOGoMailAccount.h" @@ -450,7 +452,6 @@ static NSString *sieveScriptName = @"sogo"; { NSString *sieveAction, *method, *requirement, *argument, *flag, *mailbox; NSDictionary *mailLabels; - SOGoDomainDefaults *dd; sieveAction = nil; @@ -486,7 +487,6 @@ static NSString *sieveScriptName = @"sogo"; } else if ([method isEqualToString: @"fileinto"]) { - dd = [user domainDefaults]; mailbox = [[argument componentsSeparatedByString: @"/"] componentsJoinedByString: delimiter]; @@ -789,6 +789,7 @@ static NSString *sieveScriptName = @"sogo"; SOGoUserDefaults *ud; SOGoDomainDefaults *dd; NGSieveClient *client; + NGImap4Client *imapClient; NSString *filterScript, *v; BOOL b, dateCapability; unsigned int now; @@ -821,9 +822,21 @@ static NSString *sieveScriptName = @"sogo"; // script = [NSMutableString string]; + // We grab the IMAP4 delimiter using the supplied username/password + if (thePassword) + { + imapClient = [NGImap4Client clientWithURL: [theAccount imap4URL]]; + [imapClient login: theUsername password: thePassword]; + } + else + imapClient = [[theAccount imap4Connection] client]; + + if (![imapClient delimiter]) + [imapClient list: @"INBOX" pattern: @""]; + // We first handle filters filterScript = [self sieveScriptWithRequirements: req - delimiter: [theAccount imap4Separator]]; + delimiter: [imapClient delimiter]]; if (filterScript) { if ([filterScript length])