diff options
-rwxr-xr-x | src/async/imap/MCIMAPAsyncConnection.cc | 14 | ||||
-rwxr-xr-x | src/async/imap/MCIMAPAsyncConnection.h | 3 | ||||
-rwxr-xr-x | src/async/imap/MCIMAPAsyncSession.cc | 10 | ||||
-rwxr-xr-x | src/async/imap/MCIMAPAsyncSession.h | 3 | ||||
-rwxr-xr-x | src/objc/imap/MCOIMAPSession.h | 21 | ||||
-rwxr-xr-x | src/objc/imap/MCOIMAPSession.mm | 14 |
6 files changed, 57 insertions, 8 deletions
diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc index aa94e3ee..30d2f9be 100755 --- a/src/async/imap/MCIMAPAsyncConnection.cc +++ b/src/async/imap/MCIMAPAsyncConnection.cc @@ -420,7 +420,19 @@ IMAPFetchContentOperation * IMAPAsyncConnection::fetchMessageAttachmentByUIDOper return op; } -IMAPOperation * IMAPAsyncConnection::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) +IMAPOperation * IMAPAsyncConnection::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags) +{ + IMAPStoreFlagsOperation * op = new IMAPStoreFlagsOperation(); + op->setSession(this); + op->setFolder(folder); + op->setUids(uids); + op->setKind(kind); + op->setFlags(flags); + op->autorelease(); + return op; +} + +IMAPOperation * IMAPAsyncConnection::storeAllFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) { IMAPStoreFlagsOperation * op = new IMAPStoreFlagsOperation(); op->setSession(this); diff --git a/src/async/imap/MCIMAPAsyncConnection.h b/src/async/imap/MCIMAPAsyncConnection.h index e380c5e1..c2734aff 100755 --- a/src/async/imap/MCIMAPAsyncConnection.h +++ b/src/async/imap/MCIMAPAsyncConnection.h @@ -116,7 +116,8 @@ namespace mailcore { virtual IMAPFetchContentOperation * fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID, Encoding encoding); - virtual IMAPOperation * storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags); + virtual IMAPOperation * storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags); + virtual IMAPOperation * storeAllFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags); virtual IMAPOperation * storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels); virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchKind kind, String * searchString); diff --git a/src/async/imap/MCIMAPAsyncSession.cc b/src/async/imap/MCIMAPAsyncSession.cc index d6556309..9cb7992a 100755 --- a/src/async/imap/MCIMAPAsyncSession.cc +++ b/src/async/imap/MCIMAPAsyncSession.cc @@ -418,10 +418,16 @@ IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageAttachmentByUIDOperati return session->fetchMessageAttachmentByUIDOperation(folder, uid, partID, encoding); } -IMAPOperation * IMAPAsyncSession::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) +IMAPOperation * IMAPAsyncSession::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags) { IMAPAsyncConnection * session = sessionForFolder(folder); - return session->storeFlagsOperation(folder, uids, kind, flags, customFlags); + return session->storeFlagsOperation(folder, uids, kind, flags); +} + +IMAPOperation * IMAPAsyncSession::storeAllFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) +{ + IMAPAsyncConnection * session = sessionForFolder(folder); + return session->storeAllFlagsOperation(folder, uids, kind, flags, customFlags); } IMAPOperation * IMAPAsyncSession::storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels) diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h index 38d14e0f..f81e6306 100755 --- a/src/async/imap/MCIMAPAsyncSession.h +++ b/src/async/imap/MCIMAPAsyncSession.h @@ -132,7 +132,8 @@ namespace mailcore { virtual IMAPFetchContentOperation * fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID, Encoding encoding, bool urgent = false); - virtual IMAPOperation * storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags); + virtual IMAPOperation * storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags); + virtual IMAPOperation * storeAllFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags); virtual IMAPOperation * storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels); virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchKind kind, String * searchString); diff --git a/src/objc/imap/MCOIMAPSession.h b/src/objc/imap/MCOIMAPSession.h index 5e27fba8..deacfe3d 100755 --- a/src/objc/imap/MCOIMAPSession.h +++ b/src/objc/imap/MCOIMAPSession.h @@ -293,8 +293,7 @@ MCOIMAPOperation * op = [session storeFlagsOperationWithFolder:@"INBOX" uids:[MCOIndexSet indexSetWithIndex:456] kind:MCOIMAPStoreFlagsRequestKindAdd - flags:MCOMessageFlagSeen] - customFlags:@["$Forwarded"]; + flags:MCOMessageFlagSeen]; [op start:^(NSError * error) { ... }]; @@ -302,6 +301,24 @@ - (MCOIMAPOperation *) storeFlagsOperationWithFolder:(NSString *)folder uids:(MCOIndexSet *)uids kind:(MCOIMAPStoreFlagsRequestKind)kind + flags:(MCOMessageFlag)flags; +/** + Returns an operation to change flags of messages. + + For example: Adds the seen flag to the message with UID 456. + + MCOIMAPOperation * op = [session storeFlagsOperationWithFolder:@"INBOX" + uids:[MCOIndexSet indexSetWithIndex:456] + kind:MCOIMAPStoreFlagsRequestKindAdd + flags:MCOMessageFlagSeen + customFlags:@["$Forwarded"]]; + [op start:^(NSError * error) { + ... + }]; + */ +- (MCOIMAPOperation *) storeAllFlagsOperationWithFolder:(NSString *)folder + uids:(MCOIndexSet *)uids + kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flags customFlags:(NSArray *)customFlags; /** diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm index 94f86139..f489acd7 100755 --- a/src/objc/imap/MCOIMAPSession.mm +++ b/src/objc/imap/MCOIMAPSession.mm @@ -339,11 +339,23 @@ MCO_OBJC_SYNTHESIZE_SCALAR(dispatch_queue_t, dispatch_queue_t, setDispatchQueue, uids:(MCOIndexSet *)uids kind:(MCOIMAPStoreFlagsRequestKind)kind flags:(MCOMessageFlag)flags - customFlags:(NSArray *)customFlags { IMAPOperation * coreOp = MCO_NATIVE_INSTANCE->storeFlagsOperation([folder mco_mcString], MCO_FROM_OBJC(IndexSet, uids), (IMAPStoreFlagsRequestKind) kind, + (MessageFlag) flags); + return OPAQUE_OPERATION(coreOp); +} + +- (MCOIMAPOperation *) storeAllFlagsOperationWithFolder:(NSString *)folder + uids:(MCOIndexSet *)uids + kind:(MCOIMAPStoreFlagsRequestKind)kind + flags:(MCOMessageFlag)flags + customFlags:(NSArray *)customFlags +{ + IMAPOperation * coreOp = MCO_NATIVE_INSTANCE->storeAllFlagsOperation([folder mco_mcString], + MCO_FROM_OBJC(IndexSet, uids), + (IMAPStoreFlagsRequestKind) kind, (MessageFlag) flags, MCO_FROM_OBJC(Array, customFlags)); return OPAQUE_OPERATION(coreOp); |