Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add Fetching mail with UID or Sequence number Index set. #90

Merged
merged 1 commit into from

3 participants

@pitiphong-p

In Cocoa ordered collection API. IndexSet is used for represented index of the data in ordered collection. So I think it would be great for add the fetch mail API that used IndexSet as the parameter.

Source/CTCoreFolder.h
@@ -121,6 +121,65 @@
*/
- (NSArray *)messagesFromUID:(NSUInteger)startUID to:(NSUInteger)endUID withFetchAttributes:(CTFetchAttributes)attrs;
+<<<<<<< Updated upstream
@jwilling Collaborator
jwilling added a note

Looks like there is a merge conflict here and on line 182.

Sorry about that. Pushed the new code already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pitiphong-p

@jwilling Sorry for the conflicted code. Pushed the fixed.

@mronge mronge merged commit 3a5e94a into MailCore:master
@mronge
Owner

This is great, thanks!

@pitiphong-p pitiphong-p deleted the pitiphong-p:fetch_with_indexset branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 50 additions and 0 deletions.
  1. +29 −0 Source/CTCoreFolder.h
  2. +21 −0 Source/CTCoreFolder.m
View
29 Source/CTCoreFolder.h
@@ -121,6 +121,35 @@
*/
- (NSArray *)messagesFromUID:(NSUInteger)startUID to:(NSUInteger)endUID withFetchAttributes:(CTFetchAttributes)attrs;
+
+/**
+ Use this method to download message lists from the server.
+
+ This method uses sequence numbers indexset to determine which messages to download.
+
+ @param sequenceNumbers The indexset of sequence numbers to load.
+ @param attrs This controls what is fetched.
+ @return Returns a NSArray of CTCoreMessage's. Returns nil on error
+ @see messagesFromSequenceNumber:to:withFetchAttributes:
+ */
+- (NSArray *)messagesWithSequenceNumbers:(NSIndexSet *)sequenceNumbers
+ fetchAttributes:(CTFetchAttributes)attrs;
+
+
+/**
+ Use this method to download message lists from the server.
+
+ This method uses uid numbers indexset to determine which messages to download.
+
+ @param uidNumbers The indexset of uid numbers to load.
+ @param attrs This controls what is fetched.
+ @return Returns a NSArray of CTCoreMessage's. Returns nil on error
+ @see messagesFromSequenceNumber:to:withFetchAttributes:
+ */
+- (NSArray *)messagesWithUIDs:(NSIndexSet *)uidNumbers
+ fetchAttributes:(CTFetchAttributes)attrs;
+
+
/**
Pulls the sequence number for the message with the specified uid.
It does not perform UID validation, and the sequence ID is only
View
21 Source/CTCoreFolder.m
@@ -641,6 +641,27 @@ - (NSArray *)messagesFromUID:(NSUInteger)startUID to:(NSUInteger)endUID withFetc
return results;
}
+- (NSArray *)messagesWithSequenceNumbers:(NSIndexSet *)sequenceNumbers
+ fetchAttributes:(CTFetchAttributes)attrs {
+ struct mailimap_set *set = mailimap_set_new_empty();
+ [sequenceNumbers enumerateRangesUsingBlock:^(NSRange range, BOOL *stop) {
+ mailimap_set_add_interval(set, range.location, range.location + range.length - 1);
+ }];
+
+ return [self messagesForSet:set fetchAttributes:attrs uidFetch:NO];
+
+}
+
+- (NSArray *)messagesWithUIDs:(NSIndexSet *)uidNumbers
+ fetchAttributes:(CTFetchAttributes)attrs {
+ struct mailimap_set *set = mailimap_set_new_empty();
+ [uidNumbers enumerateRangesUsingBlock:^(NSRange range, BOOL *stop) {
+ mailimap_set_add_interval(set, range.location, range.location + range.length - 1);
+ }];
+
+ return [self messagesForSet:set fetchAttributes:attrs uidFetch:YES];
+}
+
- (CTCoreMessage *)messageWithUID:(NSUInteger)uid {
int err;
struct mailmessage *msgStruct;
Something went wrong with that request. Please try again.