aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/async
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-03 23:10:15 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-03 23:10:24 -0800
commitda10b9124b52e34ac49edd1120bc04926e0a44e6 (patch)
treee0b788d613d7cac4408a983dfedd55721fbdc187 /src/async
parenta54deab9ad377fb36b21ec1fd67a67cb71824ea9 (diff)
Refactoring, fixed #1013
Diffstat (limited to 'src/async')
-rwxr-xr-xsrc/async/imap/MCAsyncIMAP.h1
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.cpp4
-rwxr-xr-xsrc/async/imap/MCIMAPAsyncSession.h4
-rw-r--r--src/async/imap/MCIMAPFolderInfo.cpp106
-rw-r--r--src/async/imap/MCIMAPFolderInfo.h63
-rw-r--r--src/async/imap/MCIMAPFolderInfoOperation.cpp54
-rw-r--r--src/async/imap/MCIMAPFolderInfoOperation.h24
7 files changed, 195 insertions, 61 deletions
diff --git a/src/async/imap/MCAsyncIMAP.h b/src/async/imap/MCAsyncIMAP.h
index 15c9e482..8a490aa8 100755
--- a/src/async/imap/MCAsyncIMAP.h
+++ b/src/async/imap/MCAsyncIMAP.h
@@ -19,6 +19,7 @@
#include <MailCore/MCIMAPFetchContentOperation.h>
#include <MailCore/MCIMAPFetchParsedContentOperation.h>
#include <MailCore/MCIMAPIdleOperation.h>
+#include <MailCore/MCIMAPFolderInfo.h>
#include <MailCore/MCIMAPFolderInfoOperation.h>
#include <MailCore/MCIMAPFolderStatusOperation.h>
#include <MailCore/MCIMAPSession.h>
diff --git a/src/async/imap/MCIMAPAsyncSession.cpp b/src/async/imap/MCIMAPAsyncSession.cpp
index f3a55a5e..d9fb38d5 100755
--- a/src/async/imap/MCIMAPAsyncSession.cpp
+++ b/src/async/imap/MCIMAPAsyncSession.cpp
@@ -485,8 +485,8 @@ IMAPFetchMessagesOperation * IMAPAsyncSession::fetchMessagesByNumberOperation(St
return op;
}
-IMAPFetchMessagesOperation * IMAPAsyncSession::syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
- IndexSet * uids, uint64_t modSeq)
+IMAPFetchMessagesOperation * IMAPAsyncSession::syncMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind,
+ IndexSet * uids, uint64_t modSeq)
{
IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation();
op->setMainSession(this);
diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h
index 4a61393f..64258674 100755
--- a/src/async/imap/MCIMAPAsyncSession.h
+++ b/src/async/imap/MCIMAPAsyncSession.h
@@ -127,8 +127,8 @@ namespace mailcore {
IndexSet * indexes);
virtual IMAPFetchMessagesOperation * fetchMessagesByNumberOperation(String * folder, IMAPMessagesRequestKind requestKind,
IndexSet * indexes);
- virtual IMAPFetchMessagesOperation * syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
- IndexSet * indexes, uint64_t modSeq);
+ virtual IMAPFetchMessagesOperation * syncMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind,
+ IndexSet * indexes, uint64_t modSeq);
virtual IMAPFetchContentOperation * fetchMessageByUIDOperation(String * folder, uint32_t uid, bool urgent = false);
virtual IMAPFetchContentOperation * fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID,
diff --git a/src/async/imap/MCIMAPFolderInfo.cpp b/src/async/imap/MCIMAPFolderInfo.cpp
new file mode 100644
index 00000000..2f790ca4
--- /dev/null
+++ b/src/async/imap/MCIMAPFolderInfo.cpp
@@ -0,0 +1,106 @@
+//
+// MCIMAPFolderInfo.cpp
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 12/6/14.
+// Copyright (c) 2014 MailCore. All rights reserved.
+//
+
+#include "MCIMAPFolderInfo.h"
+
+using namespace mailcore;
+
+void IMAPFolderInfo::init()
+{
+ mUidNext = 0;
+ mUidValidity = 0;
+ mMessageCount = 0;
+ mModSequenceValue = 0;
+ mFirstUnseenUid = 0;
+ mAllowsNewPermanentFlags = false;
+}
+
+IMAPFolderInfo::IMAPFolderInfo()
+{
+ init();
+}
+
+IMAPFolderInfo::IMAPFolderInfo(IMAPFolderInfo * other)
+{
+ init();
+ setUidNext(other->uidNext());
+ setUidValidity(other->uidValidity());
+ setModSequenceValue(other->modSequenceValue());
+ setMessageCount(other->messageCount());
+ setFirstUnseenUid(other->firstUnseenUid());
+ setAllowsNewPermanentFlags(other->allowsNewPermanentFlags());
+}
+
+IMAPFolderInfo::~IMAPFolderInfo()
+{
+}
+
+Object * IMAPFolderInfo::copy()
+{
+ return new IMAPFolderInfo(this);
+}
+
+void IMAPFolderInfo::setUidNext(uint32_t uidNext)
+{
+ mUidNext = uidNext;
+}
+
+uint32_t IMAPFolderInfo::uidNext()
+{
+ return mUidNext;
+}
+
+void IMAPFolderInfo::setUidValidity(uint32_t uidValidity)
+{
+ mUidValidity = uidValidity;
+}
+
+uint32_t IMAPFolderInfo::uidValidity()
+{
+ return mUidValidity;
+}
+
+void IMAPFolderInfo::setModSequenceValue(uint64_t modSequenceValue)
+{
+ mModSequenceValue = modSequenceValue;
+}
+
+uint64_t IMAPFolderInfo::modSequenceValue()
+{
+ return mModSequenceValue;
+}
+
+void IMAPFolderInfo::setMessageCount(int messageCount)
+{
+ mMessageCount = messageCount;
+}
+
+int IMAPFolderInfo::messageCount()
+{
+ return mMessageCount;
+}
+
+void IMAPFolderInfo::setFirstUnseenUid(uint32_t firstUnseenUid)
+{
+ mFirstUnseenUid = firstUnseenUid;
+}
+
+uint32_t IMAPFolderInfo::firstUnseenUid()
+{
+ return mFirstUnseenUid;
+}
+
+void IMAPFolderInfo::setAllowsNewPermanentFlags(bool allowsNewPermanentFlags)
+{
+ mAllowsNewPermanentFlags = allowsNewPermanentFlags;
+}
+
+bool IMAPFolderInfo::allowsNewPermanentFlags()
+{
+ return mAllowsNewPermanentFlags;
+}
diff --git a/src/async/imap/MCIMAPFolderInfo.h b/src/async/imap/MCIMAPFolderInfo.h
new file mode 100644
index 00000000..c0fa7c35
--- /dev/null
+++ b/src/async/imap/MCIMAPFolderInfo.h
@@ -0,0 +1,63 @@
+//
+// MCIMAPFolderInfo.h
+// mailcore2
+//
+// Created by DINH Viêt Hoà on 12/6/14.
+// Copyright (c) 2014 MailCore. All rights reserved.
+//
+
+#ifndef MAILCORE_MCIMAPFolderInfo_H
+
+#define MAILCORE_MCIMAPFolderInfo_H
+
+#include <MailCore/MCBaseTypes.h>
+#include <MailCore/MCMessageConstants.h>
+
+#ifdef __cplusplus
+
+namespace mailcore {
+
+ class MAILCORE_EXPORT IMAPFolderInfo : public Object {
+ public:
+ IMAPFolderInfo();
+ virtual ~IMAPFolderInfo();
+
+ virtual void setUidNext(uint32_t uidNext);
+ virtual uint32_t uidNext();
+
+ virtual void setUidValidity(uint32_t uidValidity);
+ virtual uint32_t uidValidity();
+
+ virtual void setModSequenceValue(uint64_t modSequenceValue);
+ virtual uint64_t modSequenceValue();
+
+ virtual void setMessageCount(int messageCount);
+ virtual int messageCount();
+
+ virtual void setFirstUnseenUid(uint32_t firstUnseenUid);
+ virtual uint32_t firstUnseenUid();
+
+ virtual void setAllowsNewPermanentFlags(bool allowsNewPermanentFlags);
+ virtual bool allowsNewPermanentFlags();
+
+ public: // subclass behavior
+ IMAPFolderInfo(IMAPFolderInfo * other);
+ virtual Object * copy();
+
+ private:
+ uint32_t mUidNext;
+ uint32_t mUidValidity;
+ uint64_t mModSequenceValue;
+ int mMessageCount;
+ uint32_t mFirstUnseenUid;
+ bool mAllowsNewPermanentFlags;
+
+ void init();
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/src/async/imap/MCIMAPFolderInfoOperation.cpp b/src/async/imap/MCIMAPFolderInfoOperation.cpp
index 0ea0d005..fc4e4462 100644
--- a/src/async/imap/MCIMAPFolderInfoOperation.cpp
+++ b/src/async/imap/MCIMAPFolderInfoOperation.cpp
@@ -10,51 +10,23 @@
#include "MCIMAPSession.h"
#include "MCIMAPAsyncConnection.h"
+#include "MCIMAPFolderInfo.h"
using namespace mailcore;
IMAPFolderInfoOperation::IMAPFolderInfoOperation()
{
- mUidNext = 0;
- mUidValidity = 0;
- mMessageCount = 0;
- mModSequenceValue = 0;
- mFirstUnseenUid = 0;
- mAllowsNewPermanentFlags = false;
+ mInfo = NULL;
}
IMAPFolderInfoOperation::~IMAPFolderInfoOperation()
{
+ MC_SAFE_RELEASE(mInfo);
}
-uint32_t IMAPFolderInfoOperation::uidNext()
+IMAPFolderInfo * IMAPFolderInfoOperation::info()
{
- return mUidNext;
-}
-
-uint32_t IMAPFolderInfoOperation::uidValidity()
-{
- return mUidValidity;
-}
-
-uint64_t IMAPFolderInfoOperation::modSequenceValue()
-{
- return mModSequenceValue;
-}
-
-int IMAPFolderInfoOperation::messageCount()
-{
- return mMessageCount;
-}
-
-uint32_t IMAPFolderInfoOperation::firstUnseenUid()
-{
- return mFirstUnseenUid;
-}
-
-bool IMAPFolderInfoOperation::allowsNewPermanentFlags()
-{
- return mAllowsNewPermanentFlags;
+ return mInfo;
}
void IMAPFolderInfoOperation::main()
@@ -73,14 +45,14 @@ void IMAPFolderInfoOperation::main()
return;
}
-
- mUidNext = session()->session()->uidNext();
- mUidValidity = session()->session()->uidValidity();
- mModSequenceValue = session()->session()->modSequenceValue();
- mMessageCount = session()->session()->lastFolderMessageCount();
- mFirstUnseenUid = session()->session()->firstUnseenUid();
- mAllowsNewPermanentFlags = session()->session()->allowsNewPermanentFlags();
-
+ mInfo = new IMAPFolderInfo();
+ mInfo->setUidNext(session()->session()->uidNext());
+ mInfo->setUidValidity(session()->session()->uidValidity());
+ mInfo->setModSequenceValue(session()->session()->modSequenceValue());
+ mInfo->setMessageCount(session()->session()->lastFolderMessageCount());
+ mInfo->setFirstUnseenUid(session()->session()->firstUnseenUid());
+ mInfo->setAllowsNewPermanentFlags(session()->session()->allowsNewPermanentFlags());
+
setError(error);
}
diff --git a/src/async/imap/MCIMAPFolderInfoOperation.h b/src/async/imap/MCIMAPFolderInfoOperation.h
index b29f40a2..e0b5128c 100644
--- a/src/async/imap/MCIMAPFolderInfoOperation.h
+++ b/src/async/imap/MCIMAPFolderInfoOperation.h
@@ -15,31 +15,23 @@
#ifdef __cplusplus
namespace mailcore {
+
+ class IMAPFolderInfo;
class MAILCORE_EXPORT IMAPFolderInfoOperation : public IMAPOperation {
public:
IMAPFolderInfoOperation();
virtual ~IMAPFolderInfoOperation();
-
- virtual uint32_t uidNext();
- virtual uint32_t uidValidity();
- virtual uint64_t modSequenceValue();
- virtual int messageCount();
- virtual uint32_t firstUnseenUid();
- virtual bool allowsNewPermanentFlags();
-
+
+ IMAPFolderInfo * info();
+
public: // subclass behavior
virtual void main();
private:
-
- uint32_t mUidNext;
- uint32_t mUidValidity;
- uint64_t mModSequenceValue;
- int mMessageCount;
- uint32_t mFirstUnseenUid;
- bool mAllowsNewPermanentFlags;
-
+
+ IMAPFolderInfo * mInfo;
+
};
}