Skip to content

Commit

Permalink
Merge pull request #1343 from serjepatoff/master
Browse files Browse the repository at this point in the history
2 new error codes
  • Loading branch information
dinhvh committed Feb 1, 2016
2 parents 1e6ee08 + cd9a226 commit 897b4a2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/abstract/MCErrorMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ static const char * localizedDescriptionTable[] = {
"An application specific password is required", /** MCOErrorGmailApplicationSpecificPasswordRequired */
"An error when requesting date", /** MCOErrorServerDate */
"No valid server found", /** MCOErrorNoValidServerFound */
"Error while running custom command", /** 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)
Expand Down
2 changes: 2 additions & 0 deletions src/core/abstract/MCMessageConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ namespace mailcore {
ErrorServerDate,
ErrorNoValidServerFound,
ErrorCustomCommand,
ErrorYahooSendMessageSpamSuspected,
ErrorYahooSendMessageDailyLimitExceeded
};

enum PartType {
Expand Down
8 changes: 8 additions & 0 deletions src/core/smtp/MCSMTPSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,14 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message
goto err;
}
}
else if (responseCode == 521 && response->locationOfString(MCSTR("over the limit")) != -1) {
* pError = ErrorYahooSendMessageDailyLimitExceeded;
goto err;
}
else if (responseCode == 554 && response->locationOfString(MCSTR("spam")) != -1) {
* pError = ErrorYahooSendMessageSpamSuspected;
goto err;
}

* pError = ErrorSendMessage;
MC_SAFE_REPLACE_COPY(String, mLastSMTPResponse, response);
Expand Down
4 changes: 4 additions & 0 deletions src/objc/abstract/MCOConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ typedef NS_ENUM(NSInteger, MCOErrorCode) {
MCOErrorNoValidServerFound,
/** Error while running custom command */
MCOErrorCustomCommand,
/** Spam was suspected by server */
MCOErrorYahooSendMessageSpamSuspected,
/** Daily limit of sent messages was hit */
MCOErrorYahooSendMessageDailyLimitExceeded,
/** The count of all errors */
MCOErrorCodeCount,
};
Expand Down

0 comments on commit 897b4a2

Please sign in to comment.