(fix) now dynamically detect and use the IMAP separator (fixes #1490)
parent
936f7dde09
commit
3187bca0ef
|
@ -1960,12 +1960,6 @@ Defaults to `/tmp`.
|
||||||
|
|
||||||
The default value is `YES`.
|
The default value is `YES`.
|
||||||
|
|
||||||
|S |NGImap4ConnectionStringSeparator
|
|
||||||
|Parameter used to set the IMAP mailbox separator. Setting this will
|
|
||||||
also have an impact on the mailbox separator used by Sieve filters.
|
|
||||||
|
|
||||||
The default separator is `/`.
|
|
||||||
|
|
||||||
|S |NGImap4AuthMechanism
|
|S |NGImap4AuthMechanism
|
||||||
|Trigger the use of the IMAP `AUTHENTICATE` command with the specified
|
|Trigger the use of the IMAP `AUTHENTICATE` command with the specified
|
||||||
SASL mechanism. Please note that feature might be limited at this time.
|
SASL mechanism. Please note that feature might be limited at this time.
|
||||||
|
|
1
NEWS
1
NEWS
|
@ -12,6 +12,7 @@ Enhancements
|
||||||
- [web] prohibit duplicate contact categories in Preferences module
|
- [web] prohibit duplicate contact categories in Preferences module
|
||||||
- [web] improve constrat of text in toolbar with input fields
|
- [web] improve constrat of text in toolbar with input fields
|
||||||
- [web] updated Angular Material to version 1.1.20
|
- [web] updated Angular Material to version 1.1.20
|
||||||
|
- [core] now dynamically detect and use the IMAP separator (#1490)
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- [web] properly handle Windows-1256 charaset (#4781)
|
- [web] properly handle Windows-1256 charaset (#4781)
|
||||||
|
|
|
@ -75,6 +75,7 @@ typedef enum {
|
||||||
|
|
||||||
/* capabilities */
|
/* capabilities */
|
||||||
- (BOOL) hasCapability: (NSString *) capability;
|
- (BOOL) hasCapability: (NSString *) capability;
|
||||||
|
- (NSString *) imap4Separator;
|
||||||
- (BOOL) supportsQuotas;
|
- (BOOL) supportsQuotas;
|
||||||
- (BOOL) supportsQResync;
|
- (BOOL) supportsQResync;
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,18 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
return [capabilities containsObject: capability];
|
return [capabilities containsObject: capability];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) imap4Separator
|
||||||
|
{
|
||||||
|
NGImap4Client *imapClient;
|
||||||
|
|
||||||
|
imapClient = [[self imap4Connection] client];
|
||||||
|
|
||||||
|
if (![imapClient delimiter])
|
||||||
|
[imapClient list: @"INBOX" pattern: @""];
|
||||||
|
|
||||||
|
return [imapClient delimiter];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) supportsQuotas
|
- (BOOL) supportsQuotas
|
||||||
{
|
{
|
||||||
return [self hasCapability: @"quota"];
|
return [self hasCapability: @"quota"];
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
- (NSString *) imapCASServiceName;
|
- (NSString *) imapCASServiceName;
|
||||||
- (NSString *) imapAclStyle;
|
- (NSString *) imapAclStyle;
|
||||||
- (NSString *) imapAclGroupIdPrefix;
|
- (NSString *) imapAclGroupIdPrefix;
|
||||||
- (NSString *) imapFolderSeparator;
|
|
||||||
- (BOOL) imapAclConformsToIMAPExt;
|
- (BOOL) imapAclConformsToIMAPExt;
|
||||||
- (BOOL) forceExternalLoginWithEmail;
|
- (BOOL) forceExternalLoginWithEmail;
|
||||||
- (BOOL) externalAvatarsEnabled;
|
- (BOOL) externalAvatarsEnabled;
|
||||||
|
|
|
@ -137,11 +137,6 @@
|
||||||
return [self stringForKey: @"NGImap4ConnectionGroupIdPrefix"];
|
return [self stringForKey: @"NGImap4ConnectionGroupIdPrefix"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) imapFolderSeparator
|
|
||||||
{
|
|
||||||
return [self stringForKey: @"NGImap4ConnectionStringSeparator"];
|
|
||||||
}
|
|
||||||
|
|
||||||
#warning this should be determined from the capabilities
|
#warning this should be determined from the capabilities
|
||||||
/* http://www.tools.ietf.org/wg/imapext/draft-ietf-imapext-acl/ */
|
/* http://www.tools.ietf.org/wg/imapext/draft-ietf-imapext-acl/ */
|
||||||
- (BOOL) imapAclConformsToIMAPExt
|
- (BOOL) imapAclConformsToIMAPExt
|
||||||
|
|
|
@ -446,6 +446,7 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) _extractSieveAction: (NSDictionary *) action
|
- (NSString *) _extractSieveAction: (NSDictionary *) action
|
||||||
|
delimiter: (NSString *) delimiter
|
||||||
{
|
{
|
||||||
NSString *sieveAction, *method, *requirement, *argument, *flag, *mailbox;
|
NSString *sieveAction, *method, *requirement, *argument, *flag, *mailbox;
|
||||||
NSDictionary *mailLabels;
|
NSDictionary *mailLabels;
|
||||||
|
@ -488,7 +489,7 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
dd = [user domainDefaults];
|
dd = [user domainDefaults];
|
||||||
mailbox
|
mailbox
|
||||||
= [[argument componentsSeparatedByString: @"/"]
|
= [[argument componentsSeparatedByString: @"/"]
|
||||||
componentsJoinedByString: [dd imapFolderSeparator]];
|
componentsJoinedByString: delimiter];
|
||||||
sieveAction = [NSString stringWithFormat: @"%@ %@",
|
sieveAction = [NSString stringWithFormat: @"%@ %@",
|
||||||
method, [mailbox asSieveQuotedString]];
|
method, [mailbox asSieveQuotedString]];
|
||||||
}
|
}
|
||||||
|
@ -520,6 +521,7 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) _extractSieveActions: (NSArray *) actions
|
- (NSArray *) _extractSieveActions: (NSArray *) actions
|
||||||
|
delimiter: (NSString *) delimiter
|
||||||
{
|
{
|
||||||
NSMutableArray *sieveActions;
|
NSMutableArray *sieveActions;
|
||||||
NSString *sieveAction;
|
NSString *sieveAction;
|
||||||
|
@ -529,7 +531,8 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
sieveActions = [NSMutableArray arrayWithCapacity: max];
|
sieveActions = [NSMutableArray arrayWithCapacity: max];
|
||||||
for (count = 0; !scriptError && count < max; count++)
|
for (count = 0; !scriptError && count < max; count++)
|
||||||
{
|
{
|
||||||
sieveAction = [self _extractSieveAction: [actions objectAtIndex: count]];
|
sieveAction = [self _extractSieveAction: [actions objectAtIndex: count]
|
||||||
|
delimiter: delimiter];
|
||||||
if (!scriptError)
|
if (!scriptError)
|
||||||
[sieveActions addObject: sieveAction];
|
[sieveActions addObject: sieveAction];
|
||||||
}
|
}
|
||||||
|
@ -538,6 +541,7 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) _convertScriptToSieve: (NSDictionary *) newScript
|
- (NSString *) _convertScriptToSieve: (NSDictionary *) newScript
|
||||||
|
delimiter: (NSString *) delimiter
|
||||||
{
|
{
|
||||||
NSMutableString *sieveText;
|
NSMutableString *sieveText;
|
||||||
NSString *match;
|
NSString *match;
|
||||||
|
@ -565,7 +569,8 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
else
|
else
|
||||||
scriptError = [NSString stringWithFormat: @"Bad test: %@", match];
|
scriptError = [NSString stringWithFormat: @"Bad test: %@", match];
|
||||||
}
|
}
|
||||||
sieveActions = [self _extractSieveActions: [newScript objectForKey: @"actions"]];
|
sieveActions = [self _extractSieveActions: [newScript objectForKey: @"actions"]
|
||||||
|
delimiter: delimiter];
|
||||||
if ([sieveActions count])
|
if ([sieveActions count])
|
||||||
[sieveText appendFormat: @" %@;\r\n",
|
[sieveText appendFormat: @" %@;\r\n",
|
||||||
[sieveActions componentsJoinedByString: @";\r\n "]];
|
[sieveActions componentsJoinedByString: @";\r\n "]];
|
||||||
|
@ -577,6 +582,7 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) sieveScriptWithRequirements: (NSMutableArray *) newRequirements
|
- (NSString *) sieveScriptWithRequirements: (NSMutableArray *) newRequirements
|
||||||
|
delimiter: (NSString *) delimiter
|
||||||
{
|
{
|
||||||
NSMutableString *sieveScript;
|
NSMutableString *sieveScript;
|
||||||
NSString *sieveText;
|
NSString *sieveText;
|
||||||
|
@ -599,7 +605,8 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
currentScript = [scripts objectAtIndex: count];
|
currentScript = [scripts objectAtIndex: count];
|
||||||
if ([[currentScript objectForKey: @"active"] boolValue])
|
if ([[currentScript objectForKey: @"active"] boolValue])
|
||||||
{
|
{
|
||||||
sieveText = [self _convertScriptToSieve: currentScript];
|
sieveText = [self _convertScriptToSieve: currentScript
|
||||||
|
delimiter: delimiter];
|
||||||
[sieveScript appendString: sieveText];
|
[sieveScript appendString: sieveText];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -815,7 +822,8 @@ static NSString *sieveScriptName = @"sogo";
|
||||||
script = [NSMutableString string];
|
script = [NSMutableString string];
|
||||||
|
|
||||||
// We first handle filters
|
// We first handle filters
|
||||||
filterScript = [self sieveScriptWithRequirements: req];
|
filterScript = [self sieveScriptWithRequirements: req
|
||||||
|
delimiter: [theAccount imap4Separator]];
|
||||||
if (filterScript)
|
if (filterScript)
|
||||||
{
|
{
|
||||||
if ([filterScript length])
|
if ([filterScript length])
|
||||||
|
|
Loading…
Reference in New Issue