mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-23 15:32:37 +00:00
Fix for bug #2688
This commit is contained in:
1 parent
6bab4c94f2
commit
d35c52bb38
8 files changed
+387
-74
No files matched your search
@@ -84,6 +84,8 @@ typedef enum {
|
||||
- (NSArray *) allFolderPaths;
|
||||
- (NSArray *) allFoldersMetadata;
|
||||
|
||||
- (NSDictionary *) imapFolderGUIDs;
|
||||
|
||||
- (BOOL) isInDraftsFolder;
|
||||
|
||||
/* special folders */
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
#import "SOGoUser+Mailer.h"
|
||||
|
||||
#import "SOGoMailAccount.h"
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
|
||||
|
||||
#define XMLNS_INVERSEDAV @"urn:inverse:params:xml:ns:inverse-dav"
|
||||
|
||||
@@ -659,6 +661,71 @@ static NSString *inboxFolderName = @"INBOX";
|
||||
return password;
|
||||
}
|
||||
|
||||
|
||||
- (NSDictionary *) imapFolderGUIDs
|
||||
{
|
||||
NSDictionary *result, *nresult, *folderData;
|
||||
NSMutableDictionary *folders;
|
||||
NGImap4Client *client;
|
||||
SOGoUserDefaults *ud;
|
||||
NSArray *folderList;
|
||||
NSEnumerator *e;
|
||||
NSString *guid;
|
||||
id object;
|
||||
|
||||
BOOL subscribedOnly;
|
||||
|
||||
ud = [[context activeUser] userDefaults];
|
||||
subscribedOnly = [ud mailShowSubscribedFoldersOnly];
|
||||
|
||||
folderList = [[self imap4Connection] allFoldersForURL: [self imap4URL]
|
||||
onlySubscribedFolders: subscribedOnly];
|
||||
|
||||
folders = [NSMutableDictionary dictionary];
|
||||
|
||||
client = [[self imap4Connection] client];
|
||||
result = [client annotation: @"*" entryName: @"/comment" attributeName: @"value.priv"];
|
||||
|
||||
if (![[result objectForKey: @"result"] boolValue])
|
||||
{
|
||||
NSLog(@"IMAP annotation call failed.");
|
||||
return folders;
|
||||
}
|
||||
|
||||
e = [folderList objectEnumerator];
|
||||
|
||||
while (object = [e nextObject])
|
||||
{
|
||||
guid = [[[[result objectForKey: @"FolderList"] objectForKey: [object substringFromIndex: 1]] objectForKey: @"/comment"] objectForKey: @"value.priv"];
|
||||
|
||||
if (!guid)
|
||||
{
|
||||
guid = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||
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
|
||||
//guid = [NSString stringWithFormat: @"%@-%@", [object substringFromIndex: 1], @"xxx" ];
|
||||
nresult = [client status: [object substringFromIndex: 1] flags: [NSArray arrayWithObject: @"x-guid"]];
|
||||
guid = [nresult objectForKey: @"x-guid"];
|
||||
if (!guid)
|
||||
{
|
||||
guid = [NSString stringWithFormat: @"%@", [object substringFromIndex: 1]];
|
||||
}
|
||||
NSLog(@"tfu setannotation failed: %@", nresult );
|
||||
NSLog(@"tfu uniqueid folderid: %@", guid );
|
||||
}
|
||||
}
|
||||
|
||||
[folders setObject: guid forKey: [object substringFromIndex: 1]];
|
||||
}
|
||||
|
||||
return folders;
|
||||
}
|
||||
|
||||
|
||||
/* name lookup */
|
||||
|
||||
- (id) lookupName: (NSString *) _key
|
||||
|
||||
Reference in new issue
Block a user