aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/imap/MCOIMAPFetchMessagesOperation.h
blob: c232764d0ed33ff9c5384a5a47eff7f0e486ed2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
//  MCOIMAPFetchMessagesOperation.h
//  mailcore2
//
//  Created by DINH Viêt Hoà on 3/25/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#ifndef __MAILCORE_MCOIMAPFETCHMESSAGESOPERATION_H_

#define __MAILCORE_MCOIMAPFETCHMESSAGESOPERATION_H_

#import <MailCore/MCOIMAPBaseOperation.h>
#import <MailCore/MCOConstants.h>

/** This class implements an operation to fetch a list of messages from a folder */

@class MCOIndexSet;

@interface MCOIMAPFetchMessagesOperation : MCOIMAPBaseOperation

/** This block will be called each time a new message is downloaded. */
@property (nonatomic, copy) MCOIMAPBaseOperationItemProgressBlock progress;

/** Extra headers to request. Must set requestKind | IMAPMessagesRequestKindExtraHeaders */
@property (nonatomic, copy) NSArray * extraHeaders;

/** 
 Starts the asynchronous fetch operation.

 @param completionBlock Called when the operation is finished.

 - On success `error` will be nil and `messages` will be an array of MCOIMAPMessage.
   `vanishedMessages` will contain the messages removed on the server if the server supports QRESYNC and if it was a sync request
 
 - On failure, `error` will be set with `MCOErrorDomain` as domain and an 
   error code available in `MCOConstants.h`, `messages` and `vanishedMessages` will be nil

   If you are not supporting QRESYNC you can safely ignore `vanishedMessages`.
*/
- (void) start:(void (^)(NSError * error, NSArray * /* MCOIMAPMessage */ messages, MCOIndexSet * vanishedMessages))completionBlock;

@end

#endif