Permalink
Browse files

No longer always download RFC822.Size as it is slow on some servers

  • Loading branch information...
mronge committed Mar 1, 2013
1 parent 95861d3 commit b52df2d647cffe46ee587eaf7db72509e65d40c6
Showing with 13 additions and 11 deletions.
  1. +2 −2 Source/CTCoreFolder.h
  2. +11 −9 Source/CTCoreFolder.m
View
@@ -92,12 +92,12 @@
This method take fetch attributes which configure what is fetched. Fetch attributes can be combined
so you fetch all the message data at once, or select which pieces you want for your app. You can
also fetch just the default attributes which will be as fast as possible. Pass in
- CTFetchAttrDefaultsOnly to attrs fetch the minimum possible, this includes the UID, RFC822.size, and
+ CTFetchAttrDefaultsOnly to attrs fetch the minimum possible, this includes the UID and
flags. The defaults are always fetched, even when you don't pass in this flag. Use
CTFetchAttrBodyStructure to also fetch the body structure of the message. This prevents a future
round trip done by [CTCoreMessage fetchBodyStructure], if it sees you already have the body
structure it won't re-fetch it. Use CTFetchAttrEnvelope if you'd like to fetch the subject, to,
- from, cc, bcc, sender, date etc. You can also fetch both the envelope and body structure by passing
+ from, cc, bcc, sender, date, size, etc. You can also fetch both the envelope and body structure by passing
in CTFetchAttrEnvelope | CTFetchAttrBodyStructure
View
@@ -433,7 +433,7 @@ - (BOOL)sequenceNumberForUID:(NSUInteger)uid sequenceNumber:(NSUInteger *)sequen
return YES;
}
-// We always fetch UID, RFC822.Size, and Flags
+// We always fetch UID and Flags
- (NSArray *)messagesForSet:(struct mailimap_set *)set fetchAttributes:(CTFetchAttributes)attrs uidFetch:(BOOL)uidFetch {
BOOL success = [self connect];
if (!success) {
@@ -470,14 +470,16 @@ - (NSArray *)messagesForSet:(struct mailimap_set *)set fetchAttributes:(CTFetchA
return nil;
}
- // Always fetch RFC822.Size
- fetch_att = mailimap_fetch_att_new_rfc822_size();
- r = mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att);
- if (r != MAILIMAP_NO_ERROR) {
- mailimap_fetch_att_free(fetch_att);
- mailimap_fetch_type_free(fetch_type);
- self.lastError = MailCoreCreateErrorFromIMAPCode(r);
- return nil;
+ // We only fetch RFC822.Size if the envelope is being fetched
+ if (attrs & CTFetchAttrEnvelope) {
+ fetch_att = mailimap_fetch_att_new_rfc822_size();
+ r = mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att);
+ if (r != MAILIMAP_NO_ERROR) {
+ mailimap_fetch_att_free(fetch_att);
+ mailimap_fetch_type_free(fetch_type);
+ self.lastError = MailCoreCreateErrorFromIMAPCode(r);
+ return nil;
+ }
}
// We only fetch the body structure if requested

0 comments on commit b52df2d

Please sign in to comment.