aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild-mac/mailcore2.xcodeproj/project.pbxproj24
-rw-r--r--src/async/nntp/MCAsyncNNTP.h1
-rw-r--r--src/async/nntp/MCNNTPAsyncSession.cc9
-rw-r--r--src/async/nntp/MCNNTPAsyncSession.h3
-rw-r--r--src/async/nntp/MCNNTPFetchServerTimeOperation.cpp34
-rw-r--r--src/async/nntp/MCNNTPFetchServerTimeOperation.h37
-rw-r--r--src/cmake/async.cmake1
-rw-r--r--src/cmake/objc.cmake1
-rw-r--r--src/cmake/public-headers.cmake2
-rw-r--r--src/core/nntp/MCNNTPSession.cc2
-rw-r--r--src/core/nntp/MCNNTPSession.h4
-rw-r--r--src/objc/nntp/MCONNTP.h1
-rw-r--r--src/objc/nntp/MCONNTPFetchServerTimeOperation.h35
-rw-r--r--src/objc/nntp/MCONNTPFetchServerTimeOperation.mm70
-rw-r--r--src/objc/nntp/MCONNTPSession.h10
-rw-r--r--src/objc/nntp/MCONNTPSession.mm5
16 files changed, 236 insertions, 3 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj
index 3f097d99..8d3f78ee 100755
--- a/build-mac/mailcore2.xcodeproj/project.pbxproj
+++ b/build-mac/mailcore2.xcodeproj/project.pbxproj
@@ -566,6 +566,14 @@
84CFA98A19F7168400FE35D2 /* MCNNTPFetchOverviewOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA98619F7159700FE35D2 /* MCNNTPFetchOverviewOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
84CFA98B19F716EE00FE35D2 /* MCONNTPFetchOverviewOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA98119F7153B00FE35D2 /* MCONNTPFetchOverviewOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
84CFA98C19F716EF00FE35D2 /* MCONNTPFetchOverviewOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA98119F7153B00FE35D2 /* MCONNTPFetchOverviewOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 84CFA98F19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84CFA98D19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp */; };
+ 84CFA99019F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84CFA98D19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp */; };
+ 84CFA99119F725AF00FE35D2 /* MCNNTPFetchServerTimeOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA98E19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 84CFA99219F725B000FE35D2 /* MCNNTPFetchServerTimeOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA98E19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 84CFA99519F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84CFA99419F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm */; };
+ 84CFA99619F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84CFA99419F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm */; };
+ 84CFA99719F725D300FE35D2 /* MCONNTPFetchServerTimeOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA99319F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 84CFA99819F725D400FE35D2 /* MCONNTPFetchServerTimeOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFA99319F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
84D7372C199BF66C005124E5 /* MCNNTPAsyncSession.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */; };
84D7372D199BF66C005124E5 /* MCNNTPAsyncSession.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */; };
84D73730199BF704005124E5 /* MCNNTPOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372E199BF704005124E5 /* MCNNTPOperation.cc */; };
@@ -1846,6 +1854,10 @@
84CFA98219F7153B00FE35D2 /* MCONNTPFetchOverviewOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPFetchOverviewOperation.mm; sourceTree = "<group>"; };
84CFA98519F7159700FE35D2 /* MCNNTPFetchOverviewOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPFetchOverviewOperation.cc; sourceTree = "<group>"; };
84CFA98619F7159700FE35D2 /* MCNNTPFetchOverviewOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPFetchOverviewOperation.h; sourceTree = "<group>"; };
+ 84CFA98D19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPFetchServerTimeOperation.cpp; sourceTree = "<group>"; };
+ 84CFA98E19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPFetchServerTimeOperation.h; sourceTree = "<group>"; };
+ 84CFA99319F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPFetchServerTimeOperation.h; sourceTree = "<group>"; };
+ 84CFA99419F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPFetchServerTimeOperation.mm; sourceTree = "<group>"; };
84D73729199BF63F005124E5 /* MCAsyncNNTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MCAsyncNNTP.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = MCNNTPAsyncSession.cc; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
84D7372B199BF66C005124E5 /* MCNNTPAsyncSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPAsyncSession.h; sourceTree = "<group>"; };
@@ -2421,6 +2433,8 @@
84CFA98619F7159700FE35D2 /* MCNNTPFetchOverviewOperation.h */,
84D73740199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc */,
84D73741199BF963005124E5 /* MCNNTPFetchArticlesOperation.h */,
+ 84CFA98D19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp */,
+ 84CFA98E19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.h */,
84D73744199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc */,
84D73745199BFA8C005124E5 /* MCNNTPCheckAccountOperation.h */,
84D73756199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc */,
@@ -2451,6 +2465,8 @@
84CFA98219F7153B00FE35D2 /* MCONNTPFetchOverviewOperation.mm */,
84D73773199C00AB005124E5 /* MCONNTPFetchArticlesOperation.h */,
84D73774199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm */,
+ 84CFA99319F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.h */,
+ 84CFA99419F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm */,
84D7378D199C02A8005124E5 /* MCONNTPDisconnectOperation.h */,
84D7378E199C02A8005124E5 /* MCONNTPDisconnectOperation.mm */,
84D73791199C0511005124E5 /* MCONNTPGroupInfo.h */,
@@ -3233,8 +3249,10 @@
27780E8919CFA3FA00C77E44 /* NSIndexSet+MCO.h in Headers */,
27780E8A19CFA3FA00C77E44 /* NSSet+MCO.h in Headers */,
27780E8B19CFA3FA00C77E44 /* MCOMailProvider.h in Headers */,
+ 84CFA99119F725AF00FE35D2 /* MCNNTPFetchServerTimeOperation.h in Headers */,
27780E8C19CFA3FA00C77E44 /* MCOMailProvidersManager.h in Headers */,
27780E8D19CFA3FA00C77E44 /* MCONetService.h in Headers */,
+ 84CFA99719F725D300FE35D2 /* MCONNTPFetchServerTimeOperation.h in Headers */,
27780E8E19CFA3FA00C77E44 /* MCOProvider.h in Headers */,
27780E8F19CFA3FA00C77E44 /* MCObjC.h in Headers */,
27780E9019CFA3FA00C77E44 /* MCAsyncIMAP.h in Headers */,
@@ -3494,8 +3512,10 @@
27780D9519CFA32E00C77E44 /* MCOMailProvider.h in Headers */,
27780D9619CFA32E00C77E44 /* MCOMailProvidersManager.h in Headers */,
27780D9719CFA32F00C77E44 /* MCONetService.h in Headers */,
+ 84CFA99219F725B000FE35D2 /* MCNNTPFetchServerTimeOperation.h in Headers */,
27780D9819CFA32F00C77E44 /* MCOProvider.h in Headers */,
27780D9919CFA32F00C77E44 /* MCObjC.h in Headers */,
+ 84CFA99819F725D400FE35D2 /* MCONNTPFetchServerTimeOperation.h in Headers */,
27780D9A19CFA32F00C77E44 /* MCAsyncIMAP.h in Headers */,
27780D9B19CFA32F00C77E44 /* MCIMAPAsyncConnection.h in Headers */,
27780D9C19CFA32F00C77E44 /* MCIMAPAsyncSession.h in Headers */,
@@ -3942,6 +3962,7 @@
C64EA727169E847800778456 /* MCIMAPMessagePart.cc in Sources */,
84D73775199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */,
C64EA729169E847800778456 /* MCIMAPMultipart.cc in Sources */,
+ 84CFA99519F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm in Sources */,
C64EA72B169E847800778456 /* MCIMAPNamespace.cc in Sources */,
C64EA72D169E847800778456 /* MCIMAPNamespaceItem.cc in Sources */,
C64EA72F169E847800778456 /* MCIMAPPart.cc in Sources */,
@@ -4021,6 +4042,7 @@
C63CD68116BDCDD400DB18F1 /* MCHTMLRenderer.cc in Sources */,
C63CD68216BDCDD400DB18F1 /* MCSizeFormatter.cc in Sources */,
C63CD68616BE148B00DB18F1 /* MCHTMLRendererCallback.cc in Sources */,
+ 84CFA98F19F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp in Sources */,
C63CD69116BE566E00DB18F1 /* MCHTMLCleaner.cc in Sources */,
C64BB22116E34DCB000DB34C /* MCIMAPSyncResult.cc in Sources */,
C64BB22B16E5C0A4000DB34C /* MCIMAPCapabilityOperation.cc in Sources */,
@@ -4168,6 +4190,7 @@
C6BA2BAF1705F4E6003F0E9E /* MCIMAPMessage.cc in Sources */,
C6BA2BB01705F4E6003F0E9E /* MCIMAPMessagePart.cc in Sources */,
84D73776199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */,
+ 84CFA99619F725CB00FE35D2 /* MCONNTPFetchServerTimeOperation.mm in Sources */,
C6BA2BB11705F4E6003F0E9E /* MCIMAPMultipart.cc in Sources */,
C6BA2BB21705F4E6003F0E9E /* MCIMAPNamespace.cc in Sources */,
C6BA2BB31705F4E6003F0E9E /* MCIMAPNamespaceItem.cc in Sources */,
@@ -4247,6 +4270,7 @@
C6BA2BE81705F4E6003F0E9E /* MCDateFormatter.cc in Sources */,
C6BA2BE91705F4E6003F0E9E /* MCHTMLRenderer.cc in Sources */,
C6BA2BEA1705F4E6003F0E9E /* MCSizeFormatter.cc in Sources */,
+ 84CFA99019F724E500FE35D2 /* MCNNTPFetchServerTimeOperation.cpp in Sources */,
C6BA2BEB1705F4E6003F0E9E /* MCHTMLRendererCallback.cc in Sources */,
C6BA2BEC1705F4E6003F0E9E /* MCHTMLCleaner.cc in Sources */,
C6BA2BED1705F4E6003F0E9E /* MCIMAPSyncResult.cc in Sources */,
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
diff --git a/src/cmake/async.cmake b/src/cmake/async.cmake
index 22a7d1ba..43cced00 100644
--- a/src/cmake/async.cmake
+++ b/src/cmake/async.cmake
@@ -61,6 +61,7 @@ set(async_nntp_files
async/nntp/MCNNTPFetchHeaderOperation.cc
async/nntp/MCNNTPListNewsgroupsOperation.cc
async/nntp/MCNNTPFetchOverviewOperation.cc
+ async/nntp/MCNNTPFetchServerTimeOperation.cc
async/nntp/MCNNTPOperation.cc
)
diff --git a/src/cmake/objc.cmake b/src/cmake/objc.cmake
index f9e11b42..72d50147 100644
--- a/src/cmake/objc.cmake
+++ b/src/cmake/objc.cmake
@@ -82,6 +82,7 @@ set(objc_nntp_files
objc/nntp/MCONNTPGroupInfo.mm
objc/nntp/MCONNTPListNewsgroupsOperation.mm
objc/nntp/MCONNTPFetchOverviewOperation.mm
+ objc/nntp/MCONNTPFetchServerTimeOperation.mm
objc/nntp/MCONNTPOperation.mm
objc/nntp/MCONNTPSession.mm
)
diff --git a/src/cmake/public-headers.cmake b/src/cmake/public-headers.cmake
index 5c1c6b79..0050aadf 100644
--- a/src/cmake/public-headers.cmake
+++ b/src/cmake/public-headers.cmake
@@ -114,6 +114,7 @@ async/nntp/MCNNTPListNewsgroupsOperation.h
async/nntp/MCNNTPFetchOverviewOperation.h
async/nntp/MCNNTPOperation.h
async/nntp/MCNNTPOperationCallback.h
+async/nntp/MCNNTPFetchServerTimeOperation.h
objc/MCObjC.h
objc/utils/MCOUtils.h
objc/utils/MCOObjectWrapper.h
@@ -195,6 +196,7 @@ objc/nntp/MCONNTPFetchHeaderOperation.mm
objc/nntp/MCONNTPGroupInfo.h
objc/nntp/MCONNTPListNewsgroupsOperation.h
objc/nntp/MCONNTPFetchOverviewOperation.h
+objc/nntp/MCONNTPFetchServerTimeOperation.h
objc/nntp/MCONNTPOperation.h
objc/nntp/MCONNTPSession.h
objc/provider/MCOProvider.h
diff --git a/src/core/nntp/MCNNTPSession.cc b/src/core/nntp/MCNNTPSession.cc
index 2374da41..f573c5dd 100644
--- a/src/core/nntp/MCNNTPSession.cc
+++ b/src/core/nntp/MCNNTPSession.cc
@@ -507,7 +507,7 @@ Data * NNTPSession::fetchArticleByMessageID(String * groupName, String * message
return result;
}
-time_t NNTPSession::fetchServerClock(ErrorCode * pError) {
+time_t NNTPSession::fetchServerClockTime(ErrorCode * pError) {
int r;
struct tm time;
time_t result;
diff --git a/src/core/nntp/MCNNTPSession.h b/src/core/nntp/MCNNTPSession.h
index 84a6fb4e..607f58cf 100644
--- a/src/core/nntp/MCNNTPSession.h
+++ b/src/core/nntp/MCNNTPSession.h
@@ -49,13 +49,13 @@ namespace mailcore {
virtual MessageHeader * fetchHeader(String * groupName, unsigned int index, ErrorCode * pError);
virtual Array /*MessageHeader*/ * fetchOverArticlesInRange(Range range, String * groupname, ErrorCode * pError);
-
+
virtual IndexSet * fetchAllArticles(String * groupname, ErrorCode * pError);
virtual Data * fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError);
virtual Data * fetchArticleByMessageID(String * groupname, String * messageID, ErrorCode * pError);
- virtual time_t fetchServerClock(ErrorCode * pError);
+ virtual time_t fetchServerClockTime(ErrorCode * pError);
virtual void setConnectionLogger(ConnectionLogger * logger);
virtual ConnectionLogger * connectionLogger();
diff --git a/src/objc/nntp/MCONNTP.h b/src/objc/nntp/MCONNTP.h
index 7e2f1072..364db25b 100644
--- a/src/objc/nntp/MCONNTP.h
+++ b/src/objc/nntp/MCONNTP.h
@@ -17,6 +17,7 @@
#include <MailCore/MCONNTPFetchArticlesOperation.h>
#include <MailCore/MCONNTPListNewsgroupsOperation.h>
#include <MailCore/MCONNTPFetchOverviewOperation.h>
+#include <MailCore/MCONNTPFetchServerTimeOperation.h>
#include <MailCore/MCONNTPGroupInfo.h>
#endif
diff --git a/src/objc/nntp/MCONNTPFetchServerTimeOperation.h b/src/objc/nntp/MCONNTPFetchServerTimeOperation.h
new file mode 100644
index 00000000..a06dd746
--- /dev/null
+++ b/src/objc/nntp/MCONNTPFetchServerTimeOperation.h
@@ -0,0 +1,35 @@
+//
+// MCONNTPFetchServerTimeOperation.h
+// mailcore2
+//
+// Created by Robert Widmann on 10/21/14.
+// Copyright (c) 2014 MailCore. All rights reserved.
+//
+
+#ifndef MAILCORE_MCONNTPFETCHSERVERTIMEOPERATION_H
+
+#define MAILCORE_MCONNTPFETCHSERVERTIMEOPERATION_H
+
+#import <Foundation/Foundation.h>
+#import <MailCore/MCONNTPOperation.h>
+
+@class MCOIndexSet;
+
+/** This is an asynchronous operation that will fetch the list of a messages on the NNTP server. */
+@interface MCONNTPFetchServerTimeOperation : MCONNTPOperation
+
+/**
+ Starts the asynchronous fetch operation.
+
+ @param completionBlock Called when the operation is finished.
+
+ - On success `error` will be nil and `date` will be the server's date and time as an NSDate.
+
+ - On failure, `error` will be set with `MCOErrorDomain` as domain and an
+ error code available in MCOConstants.h, `messages` will be null
+ */
+- (void) start:(void (^)(NSError * error, NSDate * date))completionBlock;
+
+@end
+
+#endif
diff --git a/src/objc/nntp/MCONNTPFetchServerTimeOperation.mm b/src/objc/nntp/MCONNTPFetchServerTimeOperation.mm
new file mode 100644
index 00000000..a2f51f91
--- /dev/null
+++ b/src/objc/nntp/MCONNTPFetchServerTimeOperation.mm
@@ -0,0 +1,70 @@
+//
+// MCONNTPFetchServerTimeOperation.m
+// mailcore2
+//
+// Created by Robert Widmann on 10/21/14.
+// Copyright (c) 2014 MailCore. All rights reserved.
+//
+
+#import "MCONNTPFetchServerTimeOperation.h"
+
+#include "MCAsyncNNTP.h"
+
+#import "MCOOperation+Private.h"
+#import "MCOUtils.h"
+
+typedef void (^CompletionType)(NSError *error, NSDate * date);
+
+@implementation MCONNTPFetchServerTimeOperation {
+ CompletionType _completionBlock;
+}
+
+#define nativeType mailcore::NNTPFetchServerTimeOperation
+
++ (void) load
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ nativeType * op = (nativeType *) object;
+ return [[[self alloc] initWithMCOperation:op] autorelease];
+}
+
+- (void) dealloc
+{
+ [_completionBlock release];
+ [super dealloc];
+}
+
+- (void) start:(void (^)(NSError *error, NSDate * date))completionBlock
+{
+ _completionBlock = [completionBlock copy];
+ [self start];
+}
+
+- (void) cancel
+{
+ [_completionBlock release];
+ _completionBlock = nil;
+ [super cancel];
+}
+
+- (void) operationCompleted
+{
+ if (_completionBlock == NULL)
+ return;
+
+ nativeType *op = MCO_NATIVE_INSTANCE;
+ if (op->error() == mailcore::ErrorNone) {
+ _completionBlock(nil, [NSDate dateWithTimeIntervalSince1970:op->time()]);
+ } else {
+ _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil);
+ }
+ [_completionBlock release];
+ _completionBlock = nil;
+}
+
+
+@end
diff --git a/src/objc/nntp/MCONNTPSession.h b/src/objc/nntp/MCONNTPSession.h
index c5fb04cc..63e7467b 100644
--- a/src/objc/nntp/MCONNTPSession.h
+++ b/src/objc/nntp/MCONNTPSession.h
@@ -21,6 +21,7 @@
@class MCONNTPFetchArticleOperation;
@class MCONNTPListNewsgroupsOperation;
@class MCONNTPFetchOverviewOperation;
+@class MCONNTPFetchServerTimeOperation;
@class MCONNTPOperation;
@class MCOIndexSet;
@@ -117,6 +118,15 @@
- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithMessageID:(NSString *)messageID inGroup:(NSString *)group;
/**
+ Returns an operation that will fetch the server's date and time.
+
+ MCONNTPFetchArticleOperation * op = [session fetchServerTimeOperation];
+ [op start:^(NSError * error, NSDate * serverTime) {
+ }];
+ */
+- (MCONNTPFetchServerTimeOperation *) fetchServerTimeOperation;
+
+/**
Returns an operation that will list all available newsgroups.
MCONNTPListNewsgroupsOperation * op = [session listAllNewsgroupsOperation];
diff --git a/src/objc/nntp/MCONNTPSession.mm b/src/objc/nntp/MCONNTPSession.mm
index 094c5886..b9d3573c 100644
--- a/src/objc/nntp/MCONNTPSession.mm
+++ b/src/objc/nntp/MCONNTPSession.mm
@@ -150,6 +150,11 @@ MCO_OBJC_SYNTHESIZE_SCALAR(dispatch_queue_t, dispatch_queue_t, setDispatchQueue,
return MCO_TO_OBJC_OP(coreOp);
}
+- (MCONNTPFetchServerTimeOperation *) fetchServerTimeOperation {
+ mailcore::NNTPFetchServerTimeOperation * coreOp = MCO_NATIVE_INSTANCE->fetchServerTimeOperation();
+ return MCO_TO_OBJC_OP(coreOp);
+}
+
- (MCONNTPListNewsgroupsOperation *) listAllNewsgroupsOperation {
mailcore::NNTPListNewsgroupsOperation * coreOp = MCO_NATIVE_INSTANCE->listAllNewsgroupsOperation();
return MCO_TO_OBJC_OP(coreOp);