diff options
author | Robert Widmann <devteam.codafi@gmail.com> | 2014-10-21 17:48:43 -0600 |
---|---|---|
committer | Robert Widmann <devteam.codafi@gmail.com> | 2014-10-21 17:48:43 -0600 |
commit | 13170ec5e2a8317559e54fb6afd02cdfbe847aca (patch) | |
tree | 719288c59788254c004918d80c252b1e40ec107d /src/async | |
parent | b547fa00319acce5333f5706c99798c0a8e709c0 (diff) |
Server Time Operations
Diffstat (limited to 'src/async')
-rw-r--r-- | src/async/nntp/MCAsyncNNTP.h | 1 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPAsyncSession.cc | 9 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPAsyncSession.h | 3 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPFetchServerTimeOperation.cpp | 34 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPFetchServerTimeOperation.h | 37 |
5 files changed, 84 insertions, 0 deletions
diff --git a/src/async/nntp/MCAsyncNNTP.h b/src/async/nntp/MCAsyncNNTP.h index 618cd3d0..4bc85241 100644 --- a/src/async/nntp/MCAsyncNNTP.h +++ b/src/async/nntp/MCAsyncNNTP.h @@ -17,6 +17,7 @@ #include <MailCore/MCNNTPFetchArticlesOperation.h> #include <MailCore/MCNNTPListNewsgroupsOperation.h> #include <MailCore/MCNNTPFetchOverviewOperation.h> +#include <MailCore/MCNNTPFetchServerTimeOperation.h> #include <MailCore/MCNNTPOperationCallback.h> #endif diff --git a/src/async/nntp/MCNNTPAsyncSession.cc b/src/async/nntp/MCNNTPAsyncSession.cc index f250a23e..b14e1970 100644 --- a/src/async/nntp/MCNNTPAsyncSession.cc +++ b/src/async/nntp/MCNNTPAsyncSession.cc @@ -15,6 +15,7 @@ #include "MCNNTPListNewsgroupsOperation.h" #include "MCNNTPFetchOverviewOperation.h" #include "MCNNTPCheckAccountOperation.h" +#include "MCNNTPFetchServerTimeOperation.h" #include "MCNNTPDisconnectOperation.h" #include "MCOperationQueueCallback.h" #include "MCConnectionLogger.h" @@ -203,6 +204,14 @@ NNTPFetchOverviewOperation * NNTPAsyncSession::fetchOverviewOperationWithIndexes return op; } +NNTPFetchServerTimeOperation * NNTPAsyncSession::fetchServerTimeOperation() +{ + NNTPFetchServerTimeOperation * op = new NNTPFetchServerTimeOperation(); + op->setSession(this); + op->autorelease(); + return op; +} + NNTPListNewsgroupsOperation * NNTPAsyncSession::listAllNewsgroupsOperation() { NNTPListNewsgroupsOperation * op = new NNTPListNewsgroupsOperation(); diff --git a/src/async/nntp/MCNNTPAsyncSession.h b/src/async/nntp/MCNNTPAsyncSession.h index b0686614..c92e09ee 100644 --- a/src/async/nntp/MCNNTPAsyncSession.h +++ b/src/async/nntp/MCNNTPAsyncSession.h @@ -15,6 +15,7 @@ namespace mailcore { class NNTPFetchArticlesOperation; class NNTPFetchOverviewOperation; class NNTPListNewsgroupsOperation; + class NNTPFetchServerTimeOperation; class NNTPOperationQueueCallback; class NNTPConnectionLogger; @@ -61,6 +62,8 @@ namespace mailcore { virtual NNTPFetchOverviewOperation * fetchOverviewOperationWithIndexes(String * groupName, IndexSet * indexes); + virtual NNTPFetchServerTimeOperation * fetchServerTimeOperation(); + virtual NNTPListNewsgroupsOperation * listAllNewsgroupsOperation(); virtual NNTPListNewsgroupsOperation * listDefaultNewsgroupsOperation(); diff --git a/src/async/nntp/MCNNTPFetchServerTimeOperation.cpp b/src/async/nntp/MCNNTPFetchServerTimeOperation.cpp new file mode 100644 index 00000000..a2729f48 --- /dev/null +++ b/src/async/nntp/MCNNTPFetchServerTimeOperation.cpp @@ -0,0 +1,34 @@ +// +// MCNNTPFetchServerTimeOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 10/21/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPFetchServerTimeOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" + +using namespace mailcore; + +NNTPFetchServerTimeOperation::NNTPFetchServerTimeOperation() +{ +} + +NNTPFetchServerTimeOperation::~NNTPFetchServerTimeOperation() +{ +} + +time_t NNTPFetchServerTimeOperation::time() +{ + return mTime; +} + +void NNTPFetchServerTimeOperation::main() +{ + ErrorCode error; + mTime = session()->session()->fetchServerClockTime(&error); + setError(error); +} diff --git a/src/async/nntp/MCNNTPFetchServerTimeOperation.h b/src/async/nntp/MCNNTPFetchServerTimeOperation.h new file mode 100644 index 00000000..22cebf25 --- /dev/null +++ b/src/async/nntp/MCNNTPFetchServerTimeOperation.h @@ -0,0 +1,37 @@ +// +// MCNNTPFetchServerTimeOperation.h +// mailcore2 +// +// Created by Robert Widmann on 10/21/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPFETCHSERVERTIMEOPERATION_H + +#define MAILCORE_MCNNTPFETCHSERVERTIMEOPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPFetchServerTimeOperation : public NNTPOperation { + public: + NNTPFetchServerTimeOperation(); + virtual ~NNTPFetchServerTimeOperation(); + + virtual time_t time(); + + public: // subclass behavior + virtual void main(); + + private: + time_t mTime; + }; + +} + +#endif + +#endif |