From ea0fb65845bc050e1b548fb3ebf1d3e91e98b3fb Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 5 Sep 2019 17:19:19 +0200 Subject: [PATCH] Refactor Sendmail Refactor Sendmail --- sonoff/i18n.h | 2 ++ sonoff/xdrv_01_webserver.ino | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sonoff/i18n.h b/sonoff/i18n.h index 287476dd7..35b51bd1f 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -96,6 +96,7 @@ #define D_JSON_LOW "Low" #define D_JSON_MAC "Mac" #define D_JSON_MASK "Mask" +#define D_JSON_MEMORY_ERROR "Memory error" #define D_JSON_MINIMAL "minimal" #define D_JSON_MODEL "Model" #define D_JSON_MQTT_COUNT "MqttCount" @@ -326,6 +327,7 @@ #define D_CMND_WEBCOLOR "WebColor" #define D_CMND_WEBSENSOR "WebSensor" #define D_CMND_EMULATION "Emulation" +#define D_CMND_SENDMAIL "Sendmail" // Commands xdrv_03_energy.ino #define D_CMND_POWERLOW "PowerLow" diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 00dcd0d49..003d9d765 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -2608,10 +2608,6 @@ bool JsonWebColor(const char* dataBuf) return true; } -#define D_CMND_SENDMAIL "sendmail" -#define D_JSON_MEMORY_ERROR "memory error" - - const char kWebSendStatus[] PROGMEM = D_JSON_DONE "|" D_JSON_WRONG_PARAMETERS "|" D_JSON_CONNECT_FAILED "|" D_JSON_HOST_NOT_FOUND "|" D_JSON_MEMORY_ERROR; const char kWebCommands[] PROGMEM = "|" // No prefix @@ -2660,9 +2656,9 @@ void CmndEmulation(void) void CmndSendmail(void) { if (XdrvMailbox.data_len > 0) { - uint8_t result = SendMail(XdrvMailbox.data); - char stemp1[20]; - ResponseCmndChar(GetTextIndexed(stemp1, sizeof(stemp1), result, kWebSendStatus)); + uint8_t result = SendMail(XdrvMailbox.data); + char stemp1[20]; + ResponseCmndChar(GetTextIndexed(stemp1, sizeof(stemp1), result, kWebSendStatus)); } } #endif // USE_SENDMAIL