diff options
Diffstat (limited to 'src/async')
-rw-r--r-- | src/async/pop/MCPOPAsyncSession.cc | 28 | ||||
-rw-r--r-- | src/async/pop/MCPOPAsyncSession.h | 4 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/async/pop/MCPOPAsyncSession.cc b/src/async/pop/MCPOPAsyncSession.cc index 39f356db..1269a34b 100644 --- a/src/async/pop/MCPOPAsyncSession.cc +++ b/src/async/pop/MCPOPAsyncSession.cc @@ -14,17 +14,44 @@ #include "MCPOPDeleteMessagesOperation.h" #include "MCPOPFetchMessagesOperation.h" #include "MCPOPCheckAccountOperation.h" +#include "MCOperationQueueCallback.h" using namespace mailcore; +namespace mailcore { + class POPOperationQueueCallback : public Object, public OperationQueueCallback { + public: + POPOperationQueueCallback(POPAsyncSession * session) { + mSession = session; + } + + virtual ~POPOperationQueueCallback() { + } + + virtual void queueStartRunning() { + mSession->retain(); + } + + virtual void queueStoppedRunning() { + mSession->release(); + } + + private: + POPAsyncSession * mSession; + }; +} + POPAsyncSession::POPAsyncSession() { mSession = new POPSession(); mQueue = new OperationQueue(); + mQueueCallback = new POPOperationQueueCallback(this); + mQueue->setCallback(mQueueCallback); } POPAsyncSession::~POPAsyncSession() { + MC_SAFE_RELEASE(mQueueCallback); MC_SAFE_RELEASE(mSession); MC_SAFE_RELEASE(mQueue); } @@ -164,6 +191,5 @@ POPSession * POPAsyncSession::session() void POPAsyncSession::runOperation(POPOperation * operation) { -#warning disconnect after delay mQueue->addOperation(operation); } diff --git a/src/async/pop/MCPOPAsyncSession.h b/src/async/pop/MCPOPAsyncSession.h index 166675e0..452d4d75 100644 --- a/src/async/pop/MCPOPAsyncSession.h +++ b/src/async/pop/MCPOPAsyncSession.h @@ -22,7 +22,8 @@ namespace mailcore { class POPFetchMessageOperation; class POPDeleteMessagesOperation; class POPFetchMessagesOperation; - + class POPOperationQueueCallback; + class POPAsyncSession : public Object { public: POPAsyncSession(); @@ -68,6 +69,7 @@ namespace mailcore { private: POPSession * mSession; OperationQueue * mQueue; + POPOperationQueueCallback * mQueueCallback; public: // private virtual void runOperation(POPOperation * operation); |