diff options
Diffstat (limited to 'src/async')
-rwxr-xr-x | src/async/imap/MCIMAPAsyncSession.cc | 54 | ||||
-rwxr-xr-x | src/async/imap/MCIMAPAsyncSession.h | 10 | ||||
-rw-r--r-- | src/async/imap/MCIMAPFetchContentOperation.cc | 27 | ||||
-rw-r--r-- | src/async/imap/MCIMAPFetchContentOperation.h | 4 | ||||
-rw-r--r-- | src/async/imap/MCIMAPFolderInfoOperation.cc | 9 | ||||
-rw-r--r-- | src/async/imap/MCIMAPFolderInfoOperation.h | 4 | ||||
-rw-r--r-- | src/async/imap/MCIMAPStoreFlagsOperation.cc | 19 | ||||
-rw-r--r-- | src/async/imap/MCIMAPStoreFlagsOperation.h | 4 | ||||
-rw-r--r-- | src/async/imap/MCIMAPStoreLabelsOperation.cc | 19 | ||||
-rw-r--r-- | src/async/imap/MCIMAPStoreLabelsOperation.h | 4 |
10 files changed, 143 insertions, 11 deletions
diff --git a/src/async/imap/MCIMAPAsyncSession.cc b/src/async/imap/MCIMAPAsyncSession.cc index 68625746..ef3bb621 100755 --- a/src/async/imap/MCIMAPAsyncSession.cc +++ b/src/async/imap/MCIMAPAsyncSession.cc @@ -524,7 +524,32 @@ IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageAttachmentByUIDOperati return op; } -IMAPOperation * IMAPAsyncSession::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) +IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageByNumberOperation(String * folder, uint32_t number, bool urgent) +{ + IMAPFetchContentOperation * op = new IMAPFetchContentOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setNumber(number); + op->setUrgent(urgent); + op->autorelease(); + return op; +} + +IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageAttachmentByNumberOperation(String * folder, uint32_t number, String * partID, + Encoding encoding, bool urgent) +{ + IMAPFetchContentOperation * op = new IMAPFetchContentOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setNumber(number); + op->setPartID(partID); + op->setEncoding(encoding); + op->setUrgent(urgent); + op->autorelease(); + return op; +} + +IMAPOperation * IMAPAsyncSession::storeFlagsByUIDOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) { IMAPStoreFlagsOperation * op = new IMAPStoreFlagsOperation(); op->setMainSession(this); @@ -537,7 +562,20 @@ IMAPOperation * IMAPAsyncSession::storeFlagsOperation(String * folder, IndexSet return op; } -IMAPOperation * IMAPAsyncSession::storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels) +IMAPOperation * IMAPAsyncSession::storeFlagsByNumberOperation(String * folder, IndexSet * numbers, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) +{ + IMAPStoreFlagsOperation * op = new IMAPStoreFlagsOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setNumbers(numbers); + op->setKind(kind); + op->setFlags(flags); + op->setCustomFlags(customFlags); + op->autorelease(); + return op; +} + +IMAPOperation * IMAPAsyncSession::storeLabelsByUIDOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels) { IMAPStoreLabelsOperation * op = new IMAPStoreLabelsOperation(); op->setMainSession(this); @@ -549,6 +587,18 @@ IMAPOperation * IMAPAsyncSession::storeLabelsOperation(String * folder, IndexSet return op; } +IMAPOperation * IMAPAsyncSession::storeLabelsByNumberOperation(String * folder, IndexSet * numbers, IMAPStoreFlagsRequestKind kind, Array * labels) +{ + IMAPStoreLabelsOperation * op = new IMAPStoreLabelsOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setNumbers(numbers); + op->setKind(kind); + op->setLabels(labels); + op->autorelease(); + return op; +} + IMAPSearchOperation * IMAPAsyncSession::searchOperation(String * folder, IMAPSearchKind kind, String * searchString) { IMAPSearchOperation * op = new IMAPSearchOperation(); diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h index 333783b2..a7ec90a0 100755 --- a/src/async/imap/MCIMAPAsyncSession.h +++ b/src/async/imap/MCIMAPAsyncSession.h @@ -133,8 +133,14 @@ 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 = NULL); - virtual IMAPOperation * storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels); + virtual IMAPFetchContentOperation * fetchMessageByNumberOperation(String * folder, uint32_t number, bool urgent = false); + virtual IMAPFetchContentOperation * fetchMessageAttachmentByNumberOperation(String * folder, uint32_t number, String * partID, + Encoding encoding, bool urgent = false); + + virtual IMAPOperation * storeFlagsByUIDOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags = NULL); + virtual IMAPOperation * storeFlagsByNumberOperation(String * folder, IndexSet * numbers, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags = NULL); + virtual IMAPOperation * storeLabelsByUIDOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels); + virtual IMAPOperation * storeLabelsByNumberOperation(String * folder, IndexSet * numbers, IMAPStoreFlagsRequestKind kind, Array * labels); virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchKind kind, String * searchString); virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchExpression * expression); diff --git a/src/async/imap/MCIMAPFetchContentOperation.cc b/src/async/imap/MCIMAPFetchContentOperation.cc index de3b911e..049ac8a7 100644 --- a/src/async/imap/MCIMAPFetchContentOperation.cc +++ b/src/async/imap/MCIMAPFetchContentOperation.cc @@ -16,6 +16,7 @@ using namespace mailcore; IMAPFetchContentOperation::IMAPFetchContentOperation() { mUid = 0; + mNumber = 0; mPartID = NULL; mEncoding = Encoding7Bit; mData = NULL; @@ -37,6 +38,16 @@ uint32_t IMAPFetchContentOperation::uid() return mUid; } +void IMAPFetchContentOperation::setNumber(uint32_t value) +{ + mNumber = value; +} + +uint32_t IMAPFetchContentOperation::number() +{ + return mNumber; +} + void IMAPFetchContentOperation::setPartID(String * partID) { MC_SAFE_REPLACE_COPY(String, mPartID, partID); @@ -65,11 +76,21 @@ Data * IMAPFetchContentOperation::data() void IMAPFetchContentOperation::main() { ErrorCode error; - if (mPartID != NULL) { - mData = session()->session()->fetchMessageAttachmentByUID(folder(), mUid, mPartID, mEncoding, this, &error); + if (mUid != 0) { + if (mPartID != NULL) { + mData = session()->session()->fetchMessageAttachmentByUID(folder(), mUid, mPartID, mEncoding, this, &error); + } + else { + mData = session()->session()->fetchMessageByUID(folder(), mUid, this, &error); + } } else { - mData = session()->session()->fetchMessageByUID(folder(), mUid, this, &error); + if (mPartID != NULL) { + mData = session()->session()->fetchMessageAttachmentByNumber(folder(), mNumber, mPartID, mEncoding, this, &error); + } + else { + mData = session()->session()->fetchMessageByNumber(folder(), mNumber, this, &error); + } } MC_SAFE_RETAIN(mData); setError(error); diff --git a/src/async/imap/MCIMAPFetchContentOperation.h b/src/async/imap/MCIMAPFetchContentOperation.h index 3d4dd17d..3cae3c5a 100644 --- a/src/async/imap/MCIMAPFetchContentOperation.h +++ b/src/async/imap/MCIMAPFetchContentOperation.h @@ -24,6 +24,9 @@ namespace mailcore { virtual void setUid(uint32_t uid); virtual uint32_t uid(); + virtual void setNumber(uint32_t value); + virtual uint32_t number(); + virtual void setPartID(String * partID); virtual String * partID(); @@ -38,6 +41,7 @@ namespace mailcore { private: uint32_t mUid; + uint32_t mNumber; String * mPartID; Encoding mEncoding; Data * mData; diff --git a/src/async/imap/MCIMAPFolderInfoOperation.cc b/src/async/imap/MCIMAPFolderInfoOperation.cc index 8ca500f3..0ea0d005 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.cc +++ b/src/async/imap/MCIMAPFolderInfoOperation.cc @@ -20,6 +20,7 @@ IMAPFolderInfoOperation::IMAPFolderInfoOperation() mMessageCount = 0; mModSequenceValue = 0; mFirstUnseenUid = 0; + mAllowsNewPermanentFlags = false; } IMAPFolderInfoOperation::~IMAPFolderInfoOperation() @@ -51,6 +52,11 @@ uint32_t IMAPFolderInfoOperation::firstUnseenUid() return mFirstUnseenUid; } +bool IMAPFolderInfoOperation::allowsNewPermanentFlags() +{ + return mAllowsNewPermanentFlags; +} + void IMAPFolderInfoOperation::main() { ErrorCode error; @@ -73,7 +79,8 @@ void IMAPFolderInfoOperation::main() mModSequenceValue = session()->session()->modSequenceValue(); mMessageCount = session()->session()->lastFolderMessageCount(); mFirstUnseenUid = session()->session()->firstUnseenUid(); - + mAllowsNewPermanentFlags = session()->session()->allowsNewPermanentFlags(); + setError(error); } diff --git a/src/async/imap/MCIMAPFolderInfoOperation.h b/src/async/imap/MCIMAPFolderInfoOperation.h index 9b0027a4..b53be2cb 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.h +++ b/src/async/imap/MCIMAPFolderInfoOperation.h @@ -26,6 +26,7 @@ namespace mailcore { virtual uint64_t modSequenceValue(); virtual int messageCount(); virtual uint32_t firstUnseenUid(); + virtual bool allowsNewPermanentFlags(); public: // subclass behavior virtual void main(); @@ -37,7 +38,8 @@ namespace mailcore { uint64_t mModSequenceValue; int mMessageCount; uint32_t mFirstUnseenUid; - + bool mAllowsNewPermanentFlags; + }; } diff --git a/src/async/imap/MCIMAPStoreFlagsOperation.cc b/src/async/imap/MCIMAPStoreFlagsOperation.cc index df68529a..a049333e 100644 --- a/src/async/imap/MCIMAPStoreFlagsOperation.cc +++ b/src/async/imap/MCIMAPStoreFlagsOperation.cc @@ -16,6 +16,7 @@ using namespace mailcore; IMAPStoreFlagsOperation::IMAPStoreFlagsOperation() { mUids = NULL; + mNumbers = NULL; mKind = IMAPStoreFlagsRequestKindAdd; mFlags = MessageFlagNone; mCustomFlags = NULL; @@ -23,6 +24,7 @@ IMAPStoreFlagsOperation::IMAPStoreFlagsOperation() IMAPStoreFlagsOperation::~IMAPStoreFlagsOperation() { + MC_SAFE_RELEASE(mNumbers); MC_SAFE_RELEASE(mUids); MC_SAFE_RELEASE(mCustomFlags); } @@ -37,6 +39,16 @@ IndexSet * IMAPStoreFlagsOperation::uids() return mUids; } +void IMAPStoreFlagsOperation::setNumbers(IndexSet * numbers) +{ + MC_SAFE_REPLACE_RETAIN(IndexSet, mNumbers, numbers); +} + +IndexSet * IMAPStoreFlagsOperation::numbers() +{ + return mNumbers; +} + void IMAPStoreFlagsOperation::setKind(IMAPStoreFlagsRequestKind kind) { mKind = kind; @@ -70,6 +82,11 @@ Array * IMAPStoreFlagsOperation::customFlags() void IMAPStoreFlagsOperation::main() { ErrorCode error; - session()->session()->storeFlagsAndCustomFlags(folder(), mUids, mKind, mFlags, mCustomFlags, &error); + if (mUids != NULL) { + session()->session()->storeFlagsAndCustomFlagsByUID(folder(), mUids, mKind, mFlags, mCustomFlags, &error); + } + else { + session()->session()->storeFlagsAndCustomFlagsByNumber(folder(), mNumbers, mKind, mFlags, mCustomFlags, &error); + } setError(error); } diff --git a/src/async/imap/MCIMAPStoreFlagsOperation.h b/src/async/imap/MCIMAPStoreFlagsOperation.h index f6219b30..1687f5cd 100644 --- a/src/async/imap/MCIMAPStoreFlagsOperation.h +++ b/src/async/imap/MCIMAPStoreFlagsOperation.h @@ -24,6 +24,9 @@ namespace mailcore { virtual void setUids(IndexSet * uids); virtual IndexSet * uids(); + virtual void setNumbers(IndexSet * numbers); + virtual IndexSet * numbers(); + virtual void setKind(IMAPStoreFlagsRequestKind kind); virtual IMAPStoreFlagsRequestKind kind(); @@ -38,6 +41,7 @@ namespace mailcore { private: IndexSet * mUids; + IndexSet * mNumbers; IMAPStoreFlagsRequestKind mKind; MessageFlag mFlags; Array * mCustomFlags; diff --git a/src/async/imap/MCIMAPStoreLabelsOperation.cc b/src/async/imap/MCIMAPStoreLabelsOperation.cc index ed738d11..3ad2212a 100644 --- a/src/async/imap/MCIMAPStoreLabelsOperation.cc +++ b/src/async/imap/MCIMAPStoreLabelsOperation.cc @@ -16,12 +16,14 @@ using namespace mailcore; IMAPStoreLabelsOperation::IMAPStoreLabelsOperation() { mUids = NULL; + mNumbers = NULL; mKind = IMAPStoreFlagsRequestKindAdd; mLabels = NULL; } IMAPStoreLabelsOperation::~IMAPStoreLabelsOperation() { + MC_SAFE_RELEASE(mNumbers); MC_SAFE_RELEASE(mUids); MC_SAFE_RELEASE(mLabels); } @@ -36,6 +38,16 @@ IndexSet * IMAPStoreLabelsOperation::uids() return mUids; } +void IMAPStoreLabelsOperation::setNumbers(IndexSet * numbers) +{ + MC_SAFE_REPLACE_RETAIN(IndexSet, mNumbers, numbers); +} + +IndexSet * IMAPStoreLabelsOperation::numbers() +{ + return mNumbers; +} + void IMAPStoreLabelsOperation::setKind(IMAPStoreFlagsRequestKind kind) { mKind = kind; @@ -59,7 +71,12 @@ Array * IMAPStoreLabelsOperation::labels() void IMAPStoreLabelsOperation::main() { ErrorCode error; - session()->session()->storeLabels(folder(), mUids, mKind, mLabels, &error); + if (mUids != NULL) { + session()->session()->storeLabelsByUID(folder(), mUids, mKind, mLabels, &error); + } + else { + session()->session()->storeLabelsByNumber(folder(), mUids, mKind, mLabels, &error); + } setError(error); } diff --git a/src/async/imap/MCIMAPStoreLabelsOperation.h b/src/async/imap/MCIMAPStoreLabelsOperation.h index 822cd83f..53348309 100644 --- a/src/async/imap/MCIMAPStoreLabelsOperation.h +++ b/src/async/imap/MCIMAPStoreLabelsOperation.h @@ -24,6 +24,9 @@ namespace mailcore { virtual void setUids(IndexSet * uids); virtual IndexSet * uids(); + virtual void setNumbers(IndexSet * numbers); + virtual IndexSet * numbers(); + virtual void setKind(IMAPStoreFlagsRequestKind kind); virtual IMAPStoreFlagsRequestKind kind(); @@ -35,6 +38,7 @@ namespace mailcore { private: IndexSet * mUids; + IndexSet * mNumbers; IMAPStoreFlagsRequestKind mKind; Array * /* String */ mLabels; |