diff options
author | Sergei Epatov <sepatov@readdle.com> | 2016-01-26 21:57:18 +0200 |
---|---|---|
committer | Sergei Epatov <sepatov@readdle.com> | 2016-01-26 21:57:18 +0200 |
commit | c9805d7e39a4ec19d5d22b9148f5e6852a15de47 (patch) | |
tree | 2932b4169e729d62d28005672c58cf083865851a /src | |
parent | 35bf8538ed83c4085eff072fc52faee047680d3e (diff) |
New errors detected and returned: ErrorSendMessageSpamSuspected, ErrorSendMessageDailyLimitExceeded
Diffstat (limited to 'src')
-rw-r--r-- | src/core/abstract/MCErrorMessage.cpp | 5 | ||||
-rw-r--r-- | src/core/smtp/MCSMTPSession.cpp | 8 | ||||
-rw-r--r-- | src/objc/abstract/MCOConstants.h | 4 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/core/abstract/MCErrorMessage.cpp b/src/core/abstract/MCErrorMessage.cpp index bbe65eb1..db1495ef 100644 --- a/src/core/abstract/MCErrorMessage.cpp +++ b/src/core/abstract/MCErrorMessage.cpp @@ -46,11 +46,14 @@ static const char * localizedDescriptionTable[] = { "An application specific password is required", /** MCOErrorGmailApplicationSpecificPasswordRequired */ "An error when requesting date", /** MCOErrorServerDate */ "No valid server found", /** MCOErrorNoValidServerFound */ + NULL, /** MCOErrorCustomCommand */ + "Cannot send message due to possible spam detected by server", /** MCOErrorSendMessageSpamSuspected */ + "User is over the limit for messages allowed to be sent in a single day", /** MCOErrorSendMessageDailyLimitExceeded */ }; String * mailcore::errorMessageWithErrorCode(ErrorCode errorCode) { - if (errorCode < 0) { + if (errorCode < 0 || errorCode == ErrorCustomCommand) { return NULL; } if (errorCode >= sizeof(localizedDescriptionTable) / sizeof(localizedDescriptionTable[0])) { diff --git a/src/core/smtp/MCSMTPSession.cpp b/src/core/smtp/MCSMTPSession.cpp index 0c2016fd..e6f4207b 100644 --- a/src/core/smtp/MCSMTPSession.cpp +++ b/src/core/smtp/MCSMTPSession.cpp @@ -682,6 +682,14 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message goto err; } } + else if (responseCode == 521 && response->locationOfString(MCSTR("limit")) != -1) { + * pError = ErrorSendMessageDailyLimitExceeded; + goto err; + } + else if (responseCode == 554 && response->locationOfString(MCSTR("spam")) != -1) { + * pError = ErrorSendMessageSpamSuspected; + goto err; + } * pError = ErrorSendMessage; MC_SAFE_REPLACE_COPY(String, mLastSMTPResponse, response); diff --git a/src/objc/abstract/MCOConstants.h b/src/objc/abstract/MCOConstants.h index 54648a0f..ac87ba28 100644 --- a/src/objc/abstract/MCOConstants.h +++ b/src/objc/abstract/MCOConstants.h @@ -413,6 +413,10 @@ typedef NS_ENUM(NSInteger, MCOErrorCode) { MCOErrorNoValidServerFound, /** Error while running custom command */ MCOErrorCustomCommand, + /** Spam was suspected by server */ + MCOErrorSendMessageSpamSuspected, + /** Daily limit of sent messages was hit */ + MCOErrorSendMessageDailyLimitExceeded, /** The count of all errors */ MCOErrorCodeCount, }; |