mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-05 16:35:10 +00:00
fix(mail(dav)): fix mail-query response
This commit is contained in:
@@ -79,8 +79,7 @@
|
||||
|
||||
static NSString *defaultUserID = @"anyone";
|
||||
|
||||
static NSComparisonResult
|
||||
_compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
static NSComparisonResult _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
{
|
||||
static NSNumber *zeroNumber = nil;
|
||||
NSNumber *modseq1, *modseq2;
|
||||
@@ -101,7 +100,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
return [modseq1 compare: modseq2];
|
||||
}
|
||||
|
||||
static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArray *uids)
|
||||
static NSInteger _compareFetchResultsByUID (id entry1, id entry2, NSArray *uids)
|
||||
{
|
||||
NSString *uid1, *uid2;
|
||||
NSUInteger pos1, pos2;
|
||||
@@ -1866,7 +1865,7 @@ static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArr
|
||||
{
|
||||
NGImap4Client *client;
|
||||
NSDictionary *response;
|
||||
NSArray *messages, *values = nil;
|
||||
NSArray *uids, *results, *sortedResults = nil;
|
||||
NSString *resultKey;
|
||||
|
||||
client = [[self imap4Connection] client];
|
||||
@@ -1886,15 +1885,17 @@ static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArr
|
||||
|
||||
if ([[response objectForKey: @"result"] boolValue])
|
||||
{
|
||||
messages = [response objectForKey: resultKey];
|
||||
if ([messages count] > 0)
|
||||
uids = [response objectForKey: resultKey];
|
||||
if ([uids count] > 0)
|
||||
{
|
||||
response = [client fetchUids: messages parts: properties];
|
||||
values = [response objectForKey: @"fetch"];
|
||||
response = [client fetchUids: uids parts: properties];
|
||||
results = [response objectForKey: @"fetch"];
|
||||
sortedResults = (NSArray *)[results sortedArrayUsingFunction: _compareFetchResultsByUID
|
||||
context: (void *)uids];
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
return sortedResults;
|
||||
}
|
||||
|
||||
- (NSArray *) _davPropstatsWithProperties: (NSArray *) davProperties
|
||||
@@ -1958,10 +1959,10 @@ static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArr
|
||||
fromMessages: (NSArray *) messages
|
||||
toResponse: (WOResponse *) response
|
||||
{
|
||||
NSDictionary *davElement;
|
||||
NSDictionary *davElement, *message;
|
||||
NSArray *propstats;
|
||||
NSMutableArray *all;
|
||||
NSString *message, *davString;
|
||||
NSString *davString;
|
||||
SEL *selectors;
|
||||
int max, count;
|
||||
|
||||
@@ -1969,19 +1970,17 @@ static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArr
|
||||
selectors = NSZoneMalloc (NULL, sizeof (max * sizeof (SEL)));
|
||||
|
||||
for (count = 0; count < max; count++)
|
||||
selectors[count]
|
||||
= SOGoSelectorForPropertyGetter ([properties objectAtIndex: count]);
|
||||
selectors[count] = SOGoSelectorForPropertyGetter ([properties objectAtIndex: count]);
|
||||
|
||||
max = [messages count];
|
||||
all = [NSMutableArray array];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
message = [[messages objectAtIndex: count] stringValue];
|
||||
message = [messages objectAtIndex: count];
|
||||
propstats = [self _davPropstatsWithProperties: properties
|
||||
andMethodSelectors: selectors
|
||||
fromMessage: message];
|
||||
davElement = davElementWithContent (@"response", XMLNS_WEBDAV,
|
||||
propstats);
|
||||
fromMessage: [[message objectForKey: @"uid"] stringValue]];
|
||||
davElement = davElementWithContent (@"response", XMLNS_WEBDAV, propstats);
|
||||
|
||||
[all addObject: davElement];
|
||||
}
|
||||
@@ -2055,14 +2054,13 @@ static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArr
|
||||
properties = [self parseDAVRequestedProperties: propElement];
|
||||
filterElement = [documentElement firstElementWithTag: @"mail-filters"
|
||||
inNamespace: XMLNS_INVERSEDAV];
|
||||
searchQualifier = [EOQualifier
|
||||
qualifierFromMailDAVMailFilters: filterElement];
|
||||
searchQualifier = [EOQualifier qualifierFromMailDAVMailFilters: filterElement];
|
||||
sortElement = (NGDOMNodeWithChildren *) [documentElement
|
||||
firstElementWithTag: @"sort"
|
||||
inNamespace: XMLNS_INVERSEDAV];
|
||||
sortOrderings = [self _sortOrderingsFromSortElement: sortElement];
|
||||
|
||||
messages = [self _fetchMessageProperties: [properties allKeys]
|
||||
messages = [self _fetchMessageProperties: [properties allValues]
|
||||
matchingQualifier: searchQualifier
|
||||
andSortOrderings: sortOrderings];
|
||||
[self _appendProperties: [properties allKeys]
|
||||
@@ -2374,7 +2372,7 @@ static NSComparisonResult _compareFetchResultsByUID (id entry1, id entry2, NSArr
|
||||
}
|
||||
else
|
||||
{
|
||||
sortedResults = [fetchResults sortedArrayUsingFunction: (int(*)(id, id, void*))_compareFetchResultsByUID
|
||||
sortedResults = [fetchResults sortedArrayUsingFunction: _compareFetchResultsByUID
|
||||
context: uids];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user