Update push.cpp

This commit is contained in:
Kevin Siml 2017-02-27 09:16:41 +01:00 committed by GitHub
parent a432dbf449
commit 333a401e79
1 changed files with 39 additions and 43 deletions

View File

@ -431,7 +431,7 @@ class CPushMod : public CModule
params["u"] = message_uri; params["u"] = message_uri;
} }
if ( options["message_uri_title"] != "" ) if (options["message_uri_title"] != "" )
{ {
params["ut"] = options["message_uri_title"]; params["ut"] = options["message_uri_title"];
} }
@ -441,20 +441,19 @@ class CPushMod : public CModule
params["d"] = options["target"]; params["d"] = options["target"];
} }
if ( options["message_sound"] != "" ) if (options["message_sound"] != "" )
{ {
params["s"] = options["message_sound"]; params["s"] = options["message_sound"];
} }
} }
else if (service == "pushalot") else if (service == "pushalot")
{ {
if (options["secret"] == "") if (options["secret"] == "")
{ {
PutModule("Error: secret (authorization token) not set"); PutModule("Error: secret (authorization token) not set");
return; return;
} }
service_host = "pushalot.com"; service_host = "pushalot.com";
service_url = "/api/sendmessage"; service_url = "/api/sendmessage";
@ -464,16 +463,15 @@ class CPushMod : public CModule
params["Body"] = message_content; params["Body"] = message_content;
if (message_uri != "") if (message_uri != "")
{ {
params["Link"] = message_uri; params["Link"] = message_uri;
} }
if ( options["message_uri_title"] != "" )
{
params["LinkTitle"] = options["message_uri_title"];
}
}
if (options["message_uri_title"] != "" )
{
params["LinkTitle"] = options["message_uri_title"];
}
}
else if (service == "prowl") else if (service == "prowl")
{ {
if (options["secret"] == "") if (options["secret"] == "")
@ -539,31 +537,30 @@ class CPushMod : public CModule
} }
else if (service == "nexmo") else if (service == "nexmo")
{ {
if (options["username"] == "") if (options["username"] == "")
{ {
PutModule("Error: username (api key) not set"); PutModule("Error: username (api key) not set");
return; return;
} }
if (options["secret"] == "") if (options["secret"] == "")
{ {
PutModule("Error: secret (api secret) not set"); PutModule("Error: secret (api secret) not set");
return; return;
} }
if (options["target"] == "") if (options["target"] == "")
{ {
PutModule("Error: destination mobile number (in international format) not set"); PutModule("Error: destination mobile number (in international format) not set");
return; return;
} }
service_host = "rest.nexmo.com"; service_host = "rest.nexmo.com";
service_url = "/sms/json"; service_url = "/sms/json";
params["api_secret"] = options["secret"];
params["api_key"] = options["username"];
params["from"] = message_title;
params["to"] = options["target"];
params["text"] = message_content;
params["api_secret"] = options["secret"];
params["api_key"] = options["username"];
params["from"] = message_title;
params["to"] = options["target"];
params["text"] = message_content;
} }
else if (service == "url") else if (service == "url")
{ {
@ -1424,10 +1421,9 @@ class CPushMod : public CModule
PutModule("Note: Pushsafer requires setting the 'private or alias key' option"); PutModule("Note: Pushsafer requires setting the 'private or alias key' option");
} }
else if (value == "pushalot") else if (value == "pushalot")
{ {
PutModule("Note: Pushalot requires setting the 'secret' (to user key) (to authorization token) option"); PutModule("Note: Pushalot requires setting the 'secret' (to user key) (to authorization token) option");
} }
else if (value == "prowl") else if (value == "prowl")
{ {
PutModule("Note: Prowl requires setting the 'secret' option"); PutModule("Note: Prowl requires setting the 'secret' option");