diff options
Diffstat (limited to 'src/async/imap/MCIMAPFetchParsedContentOperation.cpp')
-rw-r--r-- | src/async/imap/MCIMAPFetchParsedContentOperation.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/async/imap/MCIMAPFetchParsedContentOperation.cpp b/src/async/imap/MCIMAPFetchParsedContentOperation.cpp new file mode 100644 index 00000000..e32112e6 --- /dev/null +++ b/src/async/imap/MCIMAPFetchParsedContentOperation.cpp @@ -0,0 +1,79 @@ +// +// IMAPFetchParsedContentOperation.cc +// mailcore2 +// +// Created by DINH Viêt Hoà on 1/12/13. +// Copyright (c) 2013 MailCore. All rights reserved. +// + +#include "MCIMAPFetchParsedContentOperation.h" + +#include "MCIMAPSession.h" +#include "MCIMAPAsyncConnection.h" + +using namespace mailcore; + +IMAPFetchParsedContentOperation::IMAPFetchParsedContentOperation() +{ + mUid = 0; + mNumber = 0; + mEncoding = Encoding7Bit; + mParser = NULL; +} + +IMAPFetchParsedContentOperation::~IMAPFetchParsedContentOperation() +{ + MC_SAFE_RELEASE(mParser); +} + +void IMAPFetchParsedContentOperation::setUid(uint32_t uid) +{ + mUid = uid; +} + +uint32_t IMAPFetchParsedContentOperation::uid() +{ + return mUid; +} + +void IMAPFetchParsedContentOperation::setNumber(uint32_t value) +{ + mNumber = value; +} + +uint32_t IMAPFetchParsedContentOperation::number() +{ + return mNumber; +} + +void IMAPFetchParsedContentOperation::setEncoding(Encoding encoding) +{ + mEncoding = encoding; +} + +Encoding IMAPFetchParsedContentOperation::encoding() +{ + return mEncoding; +} + +MessageParser * IMAPFetchParsedContentOperation::parser() +{ + return mParser; +} + +void IMAPFetchParsedContentOperation::main() +{ + ErrorCode error; + Data * data; + if (mUid != 0) { + data = session()->session()->fetchMessageByUID(folder(), mUid, this, &error); + } + else { + data = session()->session()->fetchMessageByNumber(folder(), mNumber, this, &error); + } + if (data) { + mParser = new mailcore::MessageParser(data); + } + setError(error); +} + |