Added better error checking for target

This commit is contained in:
Erhan Justice 2014-10-15 18:33:15 -07:00
parent 79572136ef
commit ff4518cad8
1 changed files with 9 additions and 8 deletions

View File

@ -471,12 +471,17 @@ class CPushMod : public CModule
{ {
if (options["username"] == "") if (options["username"] == "")
{ {
PutModule("Error: username (user key) not set"); PutModule("Error: username (api key) not set");
return; return;
} }
if (options["secret"] == "") if (options["secret"] == "")
{ {
PutModule("Error: secret (application token/key) not set"); PutModule("Error: secret (api secret) not set");
return;
}
if (options["target"] == "")
{
PutModule("Error: destination mobile number (in international format) not set");
return; return;
} }
@ -486,13 +491,9 @@ class CPushMod : public CModule
params["api_secret"] = options["secret"]; params["api_secret"] = options["secret"];
params["api_key"] = options["username"]; params["api_key"] = options["username"];
params["from"] = message_title; params["from"] = message_title;
params["to"] = options["target"];
params["text"] = message_content; params["text"] = message_content;
if (options["target"] != "")
{
params["to"] = options["target"];
}
} }
else if (service == "url") else if (service == "url")
{ {