diff options
author | CodaFi <devteam.codafi@gmail.com> | 2013-09-24 20:18:19 -0600 |
---|---|---|
committer | CodaFi <devteam.codafi@gmail.com> | 2013-09-24 20:18:19 -0600 |
commit | 3266aa128784d29c34819d745a6d4aa768f2a725 (patch) | |
tree | fed4a81d3d990ab3fd2765f076ba445a3242a67c /src/core/pop | |
parent | 512ea11d3d76666d891ace7034edb6280fa8b24c (diff) |
Implement POP noop
Diffstat (limited to 'src/core/pop')
-rw-r--r-- | src/core/pop/MCPOPSession.cc | 31 | ||||
-rw-r--r-- | src/core/pop/MCPOPSession.h | 16 |
2 files changed, 33 insertions, 14 deletions
diff --git a/src/core/pop/MCPOPSession.cc b/src/core/pop/MCPOPSession.cc index 86a4a0d3..7be6b865 100644 --- a/src/core/pop/MCPOPSession.cc +++ b/src/core/pop/MCPOPSession.cc @@ -472,14 +472,14 @@ MessageHeader * POPSession::fetchHeader(unsigned int index, ErrorCode * pError) } r = mailpop3_top(mPop, index, 0, &content, &content_len); - if (r == MAILPOP3_ERROR_STREAM) { + if (r == MAILPOP3_ERROR_STREAM) { * pError = ErrorConnection; return NULL; } else if (r != MAILPOP3_NO_ERROR) { * pError = ErrorFetch; return NULL; - } + } Data * data; data = new Data(content, (unsigned int) content_len); @@ -514,14 +514,14 @@ Data * POPSession::fetchMessage(unsigned int index, POPProgressCallback * callba r = mailpop3_retr(mPop, index, &content, &content_len); mProgressCallback = NULL; - if (r == MAILPOP3_ERROR_STREAM) { + if (r == MAILPOP3_ERROR_STREAM) { * pError = ErrorConnection; return NULL; } else if (r != MAILPOP3_NO_ERROR) { * pError = ErrorFetch; return NULL; - } + } Data * result; result = Data::dataWithBytes(content, (unsigned int) content_len); @@ -546,15 +546,15 @@ void POPSession::deleteMessage(unsigned int index, ErrorCode * pError) } r = mailpop3_dele(mPop, index); - if (r == MAILPOP3_ERROR_STREAM) { + if (r == MAILPOP3_ERROR_STREAM) { * pError = ErrorConnection; return; } else if (r != MAILPOP3_NO_ERROR) { * pError = ErrorDeleteMessage; return; - } - + } + * pError = ErrorNone; } @@ -568,6 +568,23 @@ void POPSession::checkAccount(ErrorCode * pError) loginIfNeeded(pError); } +void POPSession::noop(ErrorCode * pError) { + int r; + + if (mPop == NULL) + return; + + MCLog("connect"); + loginIfNeeded(pError); + if (* pError != ErrorNone) { + return; + } + r = mailpop3_noop(mPop); + if ((r == MAILPOP3_ERROR_STREAM) || (r == MAILPOP3_ERROR_BAD_STATE)) { + * pError = ErrorConnection; + } +} + void POPSession::setConnectionLogger(ConnectionLogger * logger) { mConnectionLogger = logger; diff --git a/src/core/pop/MCPOPSession.h b/src/core/pop/MCPOPSession.h index 5de96b60..2f16e45b 100644 --- a/src/core/pop/MCPOPSession.h +++ b/src/core/pop/MCPOPSession.h @@ -21,28 +21,28 @@ namespace mailcore { virtual void setHostname(String * hostname); virtual String * hostname(); - + virtual void setPort(unsigned int port); virtual unsigned int port(); - + virtual void setUsername(String * username); virtual String * username(); - + virtual void setPassword(String * password); virtual String * password(); - + virtual void setAuthType(AuthType authType); virtual AuthType authType(); - + virtual void setConnectionType(ConnectionType connectionType); virtual ConnectionType connectionType(); - + virtual void setTimeout(time_t timeout); virtual time_t timeout(); virtual void setCheckCertificateEnabled(bool enabled); virtual bool isCheckCertificateEnabled(); - + virtual void connect(ErrorCode * pError); virtual void disconnect(); @@ -50,6 +50,8 @@ namespace mailcore { virtual void checkAccount(ErrorCode * pError); + virtual void noop(ErrorCode * pError); + Array * /* POPMessageInfo */ fetchMessages(ErrorCode * pError); MessageHeader * fetchHeader(unsigned int index, ErrorCode * pError); |