mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-12 23:37:15 +00:00
See ChangeLog
Monotone-Parent: 878b0a3e701f87665e2ba4cf8ce540e2a8249c27 Monotone-Revision: 77d1441139223ab426bd10fee87d648b0711aeff Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-02-17T23:45:58 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
ba800297e0
commit
099e61499c
2 files changed
+25
-6
No files matched your search
@@ -460,9 +460,11 @@
|
||||
- (NSArray *) messages
|
||||
{
|
||||
NSArray *uids;
|
||||
NSDictionary *msgs;
|
||||
NSDictionary *msgs, *msg;
|
||||
NSEnumerator *msgsList;
|
||||
NSMutableArray *unsortedMsgs, *sortedMsgs;
|
||||
NSRange r;
|
||||
unsigned len;
|
||||
unsigned len, index;
|
||||
|
||||
if (!messages)
|
||||
{
|
||||
@@ -470,12 +472,26 @@
|
||||
uids = [self sortedUIDs];
|
||||
len = [uids count];
|
||||
if (len > r.length)
|
||||
/* only need to restrict if we have a lot */
|
||||
uids = [uids subarrayWithRange: r];
|
||||
|
||||
/* only need to restrict if we have a lot */
|
||||
uids = [uids subarrayWithRange: r];
|
||||
|
||||
// Don't assume the IMAP server return the messages in the
|
||||
// same order as the specified list of UIDs (specially true for
|
||||
// dovecot).
|
||||
msgs = (NSDictionary *) [[self clientObject] fetchUIDs: uids
|
||||
parts: [self fetchKeys]];
|
||||
messages = [[msgs objectForKey: @"fetch"] retain];
|
||||
unsortedMsgs = [msgs objectForKey: @"fetch"];
|
||||
sortedMsgs = [NSMutableArray arrayWithCapacity: [unsortedMsgs count]];
|
||||
msgsList = [unsortedMsgs objectEnumerator];
|
||||
while ( (msg = [msgsList nextObject]) )
|
||||
{
|
||||
index = [uids indexOfObject: [msg objectForKey: @"uid"]];
|
||||
if (index < [sortedMsgs count])
|
||||
[sortedMsgs insertObject: msg atIndex: index];
|
||||
else
|
||||
[sortedMsgs addObject: msg];
|
||||
}
|
||||
messages = [[NSArray arrayWithArray: sortedMsgs] retain];
|
||||
}
|
||||
|
||||
return messages;
|
||||
|
||||
Reference in new issue
Block a user