diff options
Diffstat (limited to 'src/async')
-rw-r--r-- | src/async/imap/MCIMAPAppendMessageOperation.cpp | 19 | ||||
-rw-r--r-- | src/async/imap/MCIMAPAppendMessageOperation.h | 6 | ||||
-rwxr-xr-x | src/async/imap/MCIMAPAsyncSession.cpp | 12 | ||||
-rwxr-xr-x | src/async/imap/MCIMAPAsyncSession.h | 3 | ||||
-rw-r--r-- | src/async/smtp/MCSMTPAsyncSession.cpp | 11 | ||||
-rw-r--r-- | src/async/smtp/MCSMTPAsyncSession.h | 2 | ||||
-rw-r--r-- | src/async/smtp/MCSMTPSendWithDataOperation.cpp | 16 | ||||
-rw-r--r-- | src/async/smtp/MCSMTPSendWithDataOperation.h | 7 |
8 files changed, 71 insertions, 5 deletions
diff --git a/src/async/imap/MCIMAPAppendMessageOperation.cpp b/src/async/imap/MCIMAPAppendMessageOperation.cpp index 23eaaea0..69ed5c5f 100644 --- a/src/async/imap/MCIMAPAppendMessageOperation.cpp +++ b/src/async/imap/MCIMAPAppendMessageOperation.cpp @@ -16,6 +16,7 @@ using namespace mailcore; IMAPAppendMessageOperation::IMAPAppendMessageOperation() { mMessageData = NULL; + mMessageFilepath = NULL; mFlags = MessageFlagNone; mCustomFlags = NULL; mDate = (time_t) -1; @@ -25,6 +26,7 @@ IMAPAppendMessageOperation::IMAPAppendMessageOperation() IMAPAppendMessageOperation::~IMAPAppendMessageOperation() { MC_SAFE_RELEASE(mMessageData); + MC_SAFE_RELEASE(mMessageFilepath); MC_SAFE_RELEASE(mCustomFlags); } @@ -38,6 +40,16 @@ Data * IMAPAppendMessageOperation::messageData() return mMessageData; } +void IMAPAppendMessageOperation::setMessageFilepath(String * path) +{ + MC_SAFE_REPLACE_RETAIN(String, mMessageFilepath, path); +} + +String * IMAPAppendMessageOperation::messageFilepath() +{ + return mMessageFilepath; +} + void IMAPAppendMessageOperation::setFlags(MessageFlag flags) { mFlags = flags; @@ -76,7 +88,12 @@ uint32_t IMAPAppendMessageOperation::createdUID() void IMAPAppendMessageOperation::main() { ErrorCode error; - session()->session()->appendMessageWithCustomFlagsAndDate(folder(), mMessageData, mFlags, mCustomFlags, mDate, this, &mCreatedUID, &error); + if (mMessageFilepath != NULL) { + session()->session()->appendMessageWithCustomFlagsAndDate(folder(), mMessageFilepath, mFlags, mCustomFlags, mDate, this, &mCreatedUID, &error); + } + else { + session()->session()->appendMessageWithCustomFlagsAndDate(folder(), mMessageData, mFlags, mCustomFlags, mDate, this, &mCreatedUID, &error); + } setError(error); } diff --git a/src/async/imap/MCIMAPAppendMessageOperation.h b/src/async/imap/MCIMAPAppendMessageOperation.h index ca3033a6..f711c988 100644 --- a/src/async/imap/MCIMAPAppendMessageOperation.h +++ b/src/async/imap/MCIMAPAppendMessageOperation.h @@ -24,7 +24,10 @@ namespace mailcore { virtual void setMessageData(Data * messageData); virtual Data * messageData(); - + + virtual void setMessageFilepath(String * path); + virtual String * messageFilepath(); + virtual void setFlags(MessageFlag flags); virtual MessageFlag flags(); @@ -41,6 +44,7 @@ namespace mailcore { private: Data * mMessageData; + String * mMessageFilepath; MessageFlag mFlags; Array * mCustomFlags; time_t mDate; diff --git a/src/async/imap/MCIMAPAsyncSession.cpp b/src/async/imap/MCIMAPAsyncSession.cpp index 7f00d105..676d9bc5 100755 --- a/src/async/imap/MCIMAPAsyncSession.cpp +++ b/src/async/imap/MCIMAPAsyncSession.cpp @@ -443,6 +443,18 @@ IMAPAppendMessageOperation * IMAPAsyncSession::appendMessageOperation(String * f return op; } +IMAPAppendMessageOperation * IMAPAsyncSession::appendMessageOperation(String * folder, String * messagePath, MessageFlag flags, Array * customFlags) +{ + IMAPAppendMessageOperation * op = new IMAPAppendMessageOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setMessageFilepath(messagePath); + op->setFlags(flags); + op->setCustomFlags(customFlags); + op->autorelease(); + return op; +} + IMAPCopyMessagesOperation * IMAPAsyncSession::copyMessagesOperation(String * folder, IndexSet * uids, String * destFolder) { IMAPCopyMessagesOperation * op = new IMAPCopyMessagesOperation(); diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h index bbffacbd..b92d8017 100755 --- a/src/async/imap/MCIMAPAsyncSession.h +++ b/src/async/imap/MCIMAPAsyncSession.h @@ -120,7 +120,8 @@ namespace mailcore { virtual IMAPOperation * unsubscribeFolderOperation(String * folder); virtual IMAPAppendMessageOperation * appendMessageOperation(String * folder, Data * messageData, MessageFlag flags, Array * customFlags = NULL); - + virtual IMAPAppendMessageOperation * appendMessageOperation(String * folder, String * messagePath, MessageFlag flags, Array * customFlags = NULL); + virtual IMAPCopyMessagesOperation * copyMessagesOperation(String * folder, IndexSet * uids, String * destFolder); virtual IMAPMoveMessagesOperation * moveMessagesOperation(String * folder, IndexSet * uids, String * destFolder); diff --git a/src/async/smtp/MCSMTPAsyncSession.cpp b/src/async/smtp/MCSMTPAsyncSession.cpp index d2f645da..46b25184 100644 --- a/src/async/smtp/MCSMTPAsyncSession.cpp +++ b/src/async/smtp/MCSMTPAsyncSession.cpp @@ -240,6 +240,17 @@ SMTPOperation * SMTPAsyncSession::sendMessageOperation(Address * from, Array * r return (SMTPOperation *) op->autorelease(); } +SMTPOperation * SMTPAsyncSession::sendMessageOperation(Address * from, Array * recipients, + String * filename) +{ + SMTPSendWithDataOperation * op = new SMTPSendWithDataOperation(); + op->setSession(this); + op->setMessageFilepath(filename); + op->setFrom(from); + op->setRecipients(recipients); + return (SMTPOperation *) op->autorelease(); +} + SMTPOperation * SMTPAsyncSession::checkAccountOperation(Address * from) { SMTPCheckAccountOperation * op = new SMTPCheckAccountOperation(); diff --git a/src/async/smtp/MCSMTPAsyncSession.h b/src/async/smtp/MCSMTPAsyncSession.h index 90849797..961df6ef 100644 --- a/src/async/smtp/MCSMTPAsyncSession.h +++ b/src/async/smtp/MCSMTPAsyncSession.h @@ -68,6 +68,8 @@ namespace mailcore { virtual SMTPOperation * sendMessageOperation(Data * messageData); virtual SMTPOperation * sendMessageOperation(Address * from, Array * recipients, Data * messageData); + virtual SMTPOperation * sendMessageOperation(Address * from, Array * recipients, + String * filename); virtual SMTPOperation * checkAccountOperation(Address * from); virtual SMTPOperation * noopOperation(); diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.cpp b/src/async/smtp/MCSMTPSendWithDataOperation.cpp index 03f6a530..4561b5d8 100644 --- a/src/async/smtp/MCSMTPSendWithDataOperation.cpp +++ b/src/async/smtp/MCSMTPSendWithDataOperation.cpp @@ -16,6 +16,7 @@ using namespace mailcore; SMTPSendWithDataOperation::SMTPSendWithDataOperation() { mMessageData = NULL; + mMessageFilepath = NULL; mFrom = NULL; mRecipients = NULL; } @@ -24,6 +25,7 @@ SMTPSendWithDataOperation::~SMTPSendWithDataOperation() { MC_SAFE_RELEASE(mFrom); MC_SAFE_RELEASE(mRecipients); + MC_SAFE_RELEASE(mMessageFilepath); MC_SAFE_RELEASE(mMessageData); } @@ -37,6 +39,16 @@ Data * SMTPSendWithDataOperation::messageData() return mMessageData; } +void SMTPSendWithDataOperation::setMessageFilepath(String * path) +{ + MC_SAFE_REPLACE_RETAIN(String, mMessageFilepath, path); +} + +String * SMTPSendWithDataOperation::messageFilepath() +{ + return mMessageFilepath; +} + void SMTPSendWithDataOperation::setFrom(Address * from) { MC_SAFE_REPLACE_COPY(Address, mFrom, from); @@ -60,6 +72,10 @@ Array * SMTPSendWithDataOperation::recipients() void SMTPSendWithDataOperation::main() { ErrorCode error; + if (mMessageFilepath != NULL) { + session()->session()->sendMessage(mFrom, mRecipients, mMessageFilepath, this, &error); + } + else if ((mFrom != NULL) && (mRecipients != NULL)) { session()->session()->sendMessage(mFrom, mRecipients, mMessageData, this, &error); } diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.h b/src/async/smtp/MCSMTPSendWithDataOperation.h index a8ee2515..768adda9 100644 --- a/src/async/smtp/MCSMTPSendWithDataOperation.h +++ b/src/async/smtp/MCSMTPSendWithDataOperation.h @@ -31,15 +31,18 @@ namespace mailcore { virtual void setMessageData(Data * data); virtual Data * messageData(); - + + virtual void setMessageFilepath(String * path); + virtual String * messageFilepath(); + public: // subclass behavior virtual void main(); private: Data * mMessageData; + String * mMessageFilepath; Array * mRecipients; Address * mFrom; - }; } |