Monotone-Parent: c85488a496026efc268c07b0e8c84d1c1d1983d7

Monotone-Revision: 42e55c8292b29dad1cd5260453c22ca05fb07f6e

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-02-19T16:25:55
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-02-19 16:25:55 +00:00
parent fb12309ed4
commit 24e065f45a
3 changed files with 63 additions and 20 deletions

View File

@ -1,5 +1,8 @@
2010-02-19 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-02-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailAccount.m (-imapAclConformsToIMAPExt:)
now based on the server's capability string.
* UI/MailerUI/UIxMailFolderActions.m (-createFolderAction): we * UI/MailerUI/UIxMailFolderActions.m (-createFolderAction): we
check if the clientObject responds to "aboluteImap4Name", check if the clientObject responds to "aboluteImap4Name",
otherwise the subscription is made to the folderName alone. otherwise the subscription is made to the folderName alone.

View File

@ -2236,7 +2236,28 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
- (BOOL)_parseACLResponseIntoHashMap:(NGMutableHashMap *)result_ { - (BOOL)_parseACLResponseIntoHashMap:(NGMutableHashMap *)result_ {
/* /*
21 GETACL INBOX 21 GETACL INBOX
@@ -1030,10 +1324,15 @@ @@ -734,6 +1028,7 @@
NSMutableArray *uids;
NSMutableArray *rights;
NSDictionary *result;
+ int length;
if (!_matchesString(self, "ACL "))
return NO;
@@ -750,6 +1045,12 @@
enumerator = [[acls componentsSeparatedByString:@" "] objectEnumerator];
while ((obj = [enumerator nextObject]) != nil) {
+ if ([obj characterAtIndex: 0] == '"') {
+ length = [obj length];
+ if ([obj characterAtIndex: length - 1] == '"') {
+ obj = [obj substringFromRange: NSMakeRange (1, length - 2)];
+ }
+ }
[uids addObject:obj];
obj = [enumerator nextObject];
[rights addObject:(obj != nil ? obj : (id)@"")];
@@ -1030,10 +1331,15 @@
_consume(self, 7); _consume(self, 7);
if (_la(self, 0) == '"') { if (_la(self, 0) == '"') {
@ -2254,7 +2275,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
else { else {
name = _parseUntil(self, ' '); name = _parseUntil(self, ' ');
} }
@@ -1073,51 +1372,6 @@ @@ -1073,51 +1379,6 @@
return YES; return YES;
} }
@ -2306,7 +2327,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
- (id)_decodeQP:(id)_string headerField:(NSString *)_field { - (id)_decodeQP:(id)_string headerField:(NSString *)_field {
if (![_string isNotNull]) if (![_string isNotNull])
return _string; return _string;
@@ -1185,7 +1439,7 @@ @@ -1185,7 +1446,7 @@
route = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace]; route = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
mailbox = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace]; mailbox = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
host = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace]; host = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
@ -2315,7 +2336,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
if (_la(self, 0) != ')') { if (_la(self, 0) != ')') {
[self logWithFormat:@"WARNING: IMAP4 envelope " [self logWithFormat:@"WARNING: IMAP4 envelope "
@"address not properly closed (c0=%c,c1=%c): %@", @"address not properly closed (c0=%c,c1=%c): %@",
@@ -1197,6 +1451,7 @@ @@ -1197,6 +1458,7 @@
address = [[NGImap4EnvelopeAddress alloc] initWithPersonalName:pname address = [[NGImap4EnvelopeAddress alloc] initWithPersonalName:pname
sourceRoute:route mailbox:mailbox sourceRoute:route mailbox:mailbox
host:host]; host:host];
@ -2323,7 +2344,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
return address; return address;
} }
@@ -1382,7 +1637,15 @@ @@ -1382,7 +1644,15 @@
#if 0 #if 0
[self logWithFormat:@"PARSE KEY: %@", key]; [self logWithFormat:@"PARSE KEY: %@", key];
#endif #endif
@ -2340,7 +2361,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
NSDictionary *content; NSDictionary *content;
if ((content = [self _parseBodyContent]) != nil) if ((content = [self _parseBodyContent]) != nil)
@@ -1594,8 +1857,11 @@ @@ -1594,8 +1864,11 @@
if (_decode) if (_decode)
data = [data decodeQuotedPrintableValueOfMIMEHeaderField:nil]; data = [data decodeQuotedPrintableValueOfMIMEHeaderField:nil];
@ -2354,7 +2375,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
} }
else { else {
str = _parseUntil2(self, ' ', ')'); str = _parseUntil2(self, ' ', ')');
@@ -1620,13 +1886,35 @@ @@ -1620,13 +1893,35 @@
return str; return str;
} }
@ -2391,7 +2412,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self) static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self)
{ {
NSMutableDictionary *list; NSMutableDictionary *list;
@@ -1646,7 +1934,7 @@ @@ -1646,7 +1941,7 @@
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
value = _parseBodyDecodeString(self, YES, YES); value = _parseBodyDecodeString(self, YES, YES);
@ -2400,7 +2421,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
} }
_consumeIfMatch(self, ')'); _consumeIfMatch(self, ')');
} }
@@ -1731,13 +2019,14 @@ @@ -1731,13 +2026,14 @@
static NSDictionary *_parseSingleBody(NGImap4ResponseParser *self, static NSDictionary *_parseSingleBody(NGImap4ResponseParser *self,
BOOL isBodyStructure) { BOOL isBodyStructure) {
NSString *type, *subtype, *bodyId, *description, NSString *type, *subtype, *bodyId, *description,
@ -2417,7 +2438,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
parameterList = _parseBodyParameterList(self); parameterList = _parseBodyParameterList(self);
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
@@ -1762,13 +2051,18 @@ @@ -1762,13 +2058,18 @@
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
[dict setObject:_parseBodyString(self, YES) forKey:@"lines"]; [dict setObject:_parseBodyString(self, YES) forKey:@"lines"];
} }
@ -2439,7 +2460,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
[dict setObject:_parseParenthesizedAddressList(self) forKey:@"from"]; [dict setObject:_parseParenthesizedAddressList(self) forKey:@"from"];
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
@@ -1783,14 +2077,20 @@ @@ -1783,14 +2084,20 @@
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
[dict setObject:_parseParenthesizedAddressList(self) forKey:@"bcc"]; [dict setObject:_parseParenthesizedAddressList(self) forKey:@"bcc"];
_consumeIfMatch(self, ' '); _consumeIfMatch(self, ' ');
@ -2463,7 +2484,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
} }
} }
@@ -1805,14 +2105,9 @@ @@ -1805,14 +2112,9 @@
forKey: @"disposition"]; forKey: @"disposition"];
if (_la(self, 0) != ')') { if (_la(self, 0) != ')') {
_consume(self,1); _consume(self,1);
@ -2481,7 +2502,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
if (_la(self, 0) != ')') { if (_la(self, 0) != ')') {
_consume(self,1); _consume(self,1);
[dict setObject: _parseBodyString(self, YES) [dict setObject: _parseBodyString(self, YES)
@@ -1829,6 +2124,7 @@ @@ -1829,6 +2131,7 @@
static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self, static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
BOOL isBodyStructure) { BOOL isBodyStructure) {
NSMutableArray *parts; NSMutableArray *parts;
@ -2489,7 +2510,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
NSString *kind; NSString *kind;
NSMutableDictionary *dict; NSMutableDictionary *dict;
@@ -1854,14 +2150,9 @@ @@ -1854,14 +2157,9 @@
forKey: @"disposition"]; forKey: @"disposition"];
if (_la(self, 0) != ')') { if (_la(self, 0) != ')') {
_consume(self,1); _consume(self,1);
@ -2507,7 +2528,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
if (_la(self, 0) != ')') { if (_la(self, 0) != ')') {
_consume(self,1); _consume(self,1);
[dict setObject: _parseBodyString(self, YES) [dict setObject: _parseBodyString(self, YES)
@@ -2170,6 +2461,21 @@ @@ -2170,6 +2468,21 @@
} }
} }
@ -2529,7 +2550,7 @@ Index: sope-mime/NGImap4/NGImap4ResponseParser.m
- (NSException *)exceptionForFailedMatch:(unsigned char)_match - (NSException *)exceptionForFailedMatch:(unsigned char)_match
got:(unsigned char)_avail got:(unsigned char)_avail
{ {
@@ -2225,9 +2531,9 @@ @@ -2225,9 +2538,9 @@
[s release]; [s release];
if (c == '\n') { if (c == '\n') {
@ -2545,7 +2566,13 @@ Index: sope-mime/NGImap4/ChangeLog
=================================================================== ===================================================================
--- sope-mime/NGImap4/ChangeLog (revision 1664) --- sope-mime/NGImap4/ChangeLog (revision 1664)
+++ sope-mime/NGImap4/ChangeLog (working copy) +++ sope-mime/NGImap4/ChangeLog (working copy)
@@ -1,3 +1,127 @@ @@ -1,3 +1,133 @@
+2010-02-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * NGImap4ResponseParser.m (_parseACLResponseIntoHashMap:): user
+ ids enclosed in quotes are extracted from them, for servers not
+ following the standards properly.
+
+2010-02-18 Wolfgang Sourdeau <wsourdeau@inverse.ca> +2010-02-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ +
+ * NGImap4ResponseParser.m (-parseResponseForTagId:exception:): the + * NGImap4ResponseParser.m (-parseResponseForTagId:exception:): the

View File

@ -197,13 +197,26 @@ static NSString *sieveScriptName = @"sogo";
return imapAclStyle; return imapAclStyle;
} }
/* see http://tools.ietf.org/id/draft-ietf-imapext-acl */
- (BOOL) imapAclConformsToIMAPExt - (BOOL) imapAclConformsToIMAPExt
{ {
SOGoDomainDefaults *dd; NGImap4Client *imapClient;
NSArray *capability;
int count, max;
BOOL conforms;
dd = [[context activeUser] domainDefaults]; conforms = NO;
return [dd imapAclConformsToIMAPExt]; imapClient = [[self imap4Connection] client];
capability = [[imapClient capability] objectForKey: @"capability"];
max = [capability count];
for (count = 0; !conforms && count < max; count++)
{
if ([[capability objectAtIndex: count] hasPrefix: @"acl2"])
conforms = YES;
}
return conforms;
} }
- (BOOL) supportsQuotas - (BOOL) supportsQuotas