Skip to content

Commit 3cd7fba

Browse files
committed
Fixed Notification Settings test button
1 parent 38015c5 commit 3cd7fba

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

notifications/NotificationNma.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "stdafx.h"
22
#include "NotificationNma.h"
33
#include "../httpclient/HTTPClient.h"
4+
#include "../main/Logger.h"
45

56
CNotificationNma::CNotificationNma() : CNotificationBase(std::string("nma"), OPTIONS_URL_SUBJECT | OPTIONS_URL_BODY | OPTIONS_URL_PARAMS)
67
{
@@ -21,8 +22,11 @@ bool CNotificationNma::SendMessageImplementation(const std::string &Subject, con
2122
sPostData << "apikey=" << _apikey << "&application=Domoticz&event=" << Subject << "&description=" << Text << "&priority=" << Priority;
2223
std::vector<std::string> ExtraHeaders;
2324
bRet = HTTPClient::POST("https://www.notifymyandroid.com/publicapi/notify",sPostData.str(),ExtraHeaders,sResult);
24-
/* todo: parse result */
25-
return bRet;
25+
26+
bool bSuccess = (sResult.find("success code=\"200\"") != std::string::npos);
27+
if (!bSuccess)
28+
_log.Log(LOG_ERROR, "NMA: %s", sResult.c_str());
29+
return (bRet && bSuccess); return bRet;
2630
}
2731

2832
bool CNotificationNma::IsConfigured()

notifications/NotificationProwl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "stdafx.h"
22
#include "NotificationProwl.h"
33
#include "../httpclient/HTTPClient.h"
4+
#include "../main/Logger.h"
45

56
CNotificationProwl::CNotificationProwl() : CNotificationBase(std::string("prowl"), OPTIONS_URL_SUBJECT | OPTIONS_URL_BODY | OPTIONS_URL_PARAMS)
67
{
@@ -21,8 +22,10 @@ bool CNotificationProwl::SendMessageImplementation(const std::string &Subject, c
2122
sPostData << "apikey=" << _apikey << "&application=Domoticz&event=" << Subject << "&description=" << Text << "&priority=" << Priority;
2223
std::vector<std::string> ExtraHeaders;
2324
bRet = HTTPClient::POST("https://api.prowlapp.com/publicapi/add",sPostData.str(),ExtraHeaders,sResult);
24-
/* todo: parse result */
25-
return bRet;
25+
bool bSuccess = (sResult.find("success code=\"200\"") != std::string::npos);
26+
if (!bSuccess)
27+
_log.Log(LOG_ERROR, "NMA: %s", sResult.c_str());
28+
return (bRet && bSuccess); return bRet;
2629
}
2730

2831
bool CNotificationProwl::IsConfigured()

www/app/SetupController.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ define(['app'], function (app) {
5757
extraparams = "HTTPField1=" + HTTPField1 + "&HTTPField2=" + HTTPField2 + "&HTTPField3=" + HTTPField3 + "&HTTPField4=" + HTTPField4 + "&HTTPTo=" + HTTPTo + "&HTTPURL=" + HTTPURL;
5858
break;
5959
case "prowl":
60-
var ProwlAPI=encodeURIComponent($("#prowltable #apikey").val());
60+
var ProwlAPI=encodeURIComponent($("#prowltable #ProwlAPI").val());
6161
if (ProwlAPI=="") {
6262
ShowNotify($.t('Please enter the API key!...'), 3500, true);
6363
return;
6464
}
6565
extraparams = "ProwlAPI=" + ProwlAPI;
6666
break;
6767
case "nma":
68-
var NMAAPI=encodeURIComponent($("#nmatable #apikey").val());
68+
var NMAAPI=encodeURIComponent($("#nmatable #NMAAPI").val());
6969
if (NMAAPI=="") {
7070
ShowNotify($.t('Please enter the API key!...'), 3500, true);
7171
return;
7272
}
7373
extraparams = "NMAAPI=" + NMAAPI;
7474
break;
7575
case "pushover":
76-
var POAPI=encodeURIComponent($("#pushovertable #apikey").val());
76+
var POAPI=encodeURIComponent($("#pushovertable #PushoverAPI").val());
7777
if (POAPI=="") {
7878
ShowNotify($.t('Please enter the API key!...'), 3500, true);
7979
return;
@@ -86,7 +86,7 @@ define(['app'], function (app) {
8686
extraparams = "POAPI=" + POAPI + "&POUSERID=" + POUSERID;
8787
break;
8888
case "pushalot":
89-
var PushAlotAPI=encodeURIComponent($("#pushalottable #palapikey").val());
89+
var PushAlotAPI=encodeURIComponent($("#pushalottable #PushALotAPI").val());
9090
if (PushAlotAPI=="") {
9191
ShowNotify($.t('Please enter the API key!...'), 3500, true);
9292
return;

www/html5.appcache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# ref 924
2+
# ref 925
33

44
CACHE:
55
# CSS

0 commit comments

Comments
 (0)