From f29a74f82f437ffce96ac15f1ab604218f0a22d6 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 15 Dec 2014 19:34:51 -0500 Subject: [PATCH] avoid testing for IMAP ANNOTATION when X-GUID is available --- NEWS | 1 + SoObjects/Mailer/SOGoMailAccount.m | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index c765c7e13..254388e31 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ New features Enhancements - updated CKEditor to version 4.4.6 and added the 'Source Area' plugin + - avoid testing for IMAP ANNOTATION when X-GUID is available Bug fixes - Fix for privacy and categories for EAS (#3022) diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index a7c492f20..772c49ecd 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -673,7 +673,7 @@ static NSString *inboxFolderName = @"INBOX"; NSString *guid; id object; - BOOL subscribedOnly; + BOOL subscribedOnly, hasAnnotatemore; ud = [[context activeUser] userDefaults]; subscribedOnly = [ud mailShowSubscribedFoldersOnly]; @@ -685,14 +685,21 @@ static NSString *inboxFolderName = @"INBOX"; client = [[self imap4Connection] client]; namespaceDict = [client namespace]; + hasAnnotatemore = [self hasCapability: @"annotatemore"]; - result = [client annotation: @"*" entryName: @"/comment" attributeName: @"value.priv"]; + if (hasAnnotatemore) + result = [client annotation: @"*" entryName: @"/comment" attributeName: @"value.priv"]; + else + result = [client lstatus: @"*" flags: [NSArray arrayWithObjects: @"x-guid", nil]]; e = [folderList objectEnumerator]; while ((object = [e nextObject])) { - guid = [[[[result objectForKey: @"FolderList"] objectForKey: [object substringFromIndex: 1]] objectForKey: @"/comment"] objectForKey: @"value.priv"]; + if (hasAnnotatemore) + guid = [[[[result objectForKey: @"FolderList"] objectForKey: [object substringFromIndex: 1]] objectForKey: @"/comment"] objectForKey: @"value.priv"]; + else + guid = [[[result objectForKey: @"status"] objectForKey: [object substringFromIndex: 1]] objectForKey: @"x-guid"]; if (!guid) { @@ -708,22 +715,13 @@ static NSString *inboxFolderName = @"INBOX"; nresult = [client annotation: [object substringFromIndex: 1] entryName: @"/comment" attributeName: @"value.priv" attributeValue: guid]; if (![[nresult objectForKey: @"result"] boolValue]) - { - // Need to implement X-GUID query for Dovecot - this requires modification in SOPE to support following command: - // 1 list "" "*" return (status (x-guid)) -> this would avoid firing a command per folder to IMAP - nresult = [client status: [object substringFromIndex: 1] flags: [NSArray arrayWithObject: @"x-guid"]]; - guid = [nresult objectForKey: @"x-guid"]; - if (!guid) - { - guid = [NSString stringWithFormat: @"%@", [object substringFromIndex: 1]]; - } - } + guid = [NSString stringWithFormat: @"%@", [object substringFromIndex: 1]]; } - + [folders setObject: [NSString stringWithFormat: @"folder%@", guid] forKey: [NSString stringWithFormat: @"folder%@", [object substringFromIndex: 1]]]; } - + return folders; }