Skip to content

Commit

Permalink
(fix) use the supplied Sieve creds to fetch the IMAP4 separator (fixe…
Browse files Browse the repository at this point in the history
…s #4846)
  • Loading branch information
extrafu committed Oct 25, 2019
1 parent 2d5d1b4 commit 34fcfe0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
13 changes: 13 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
5 changes: 3 additions & 2 deletions SoObjects/SOGo/SOGoSieveManager.h
Original file line number Diff line number Diff line change
@@ -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 <info@inverse.ca>
*
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 16 additions & 3 deletions SoObjects/SOGo/SOGoSieveManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#import <SOGo/SOGoTextTemplateFile.h>

#import <NGExtensions/NSObject+Logs.h>
#import <NGImap4/NGImap4Connection.h>
#import <NGImap4/NGImap4Client.h>
#import <NGImap4/NGSieveClient.h>

#import "../Mailer/SOGoMailAccount.h"
Expand Down Expand Up @@ -450,7 +452,6 @@ - (NSString *) _extractSieveAction: (NSDictionary *) action
{
NSString *sieveAction, *method, *requirement, *argument, *flag, *mailbox;
NSDictionary *mailLabels;
SOGoDomainDefaults *dd;

sieveAction = nil;

Expand Down Expand Up @@ -486,7 +487,6 @@ - (NSString *) _extractSieveAction: (NSDictionary *) action
}
else if ([method isEqualToString: @"fileinto"])
{
dd = [user domainDefaults];
mailbox
= [[argument componentsSeparatedByString: @"/"]
componentsJoinedByString: delimiter];
Expand Down Expand Up @@ -789,6 +789,7 @@ - (BOOL) updateFiltersForAccount: (SOGoMailAccount *) theAccount
SOGoUserDefaults *ud;
SOGoDomainDefaults *dd;
NGSieveClient *client;
NGImap4Client *imapClient;
NSString *filterScript, *v;
BOOL b, dateCapability;
unsigned int now;
Expand Down Expand Up @@ -821,9 +822,21 @@ - (BOOL) updateFiltersForAccount: (SOGoMailAccount *) theAccount
//
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])
Expand Down

0 comments on commit 34fcfe0

Please sign in to comment.