pushmsg: Fix required fields.

This commit is contained in:
tastytea 2021-09-13 11:37:01 +02:00
parent eac7ab8965
commit 54192f7804
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 7 additions and 6 deletions

View File

@ -34,9 +34,9 @@ void read_options(int argc, char *argv[])
("help,h", "Display this help and exit.")
("baseurl", po::value<std::string>()->required(),
"Example: https://push.example.org")
("token", po::value<std::string>()->required(), "Application token")
("title", po::value<std::string>()->required(), "Title of the message")
("message", po::value<std::string>(), "Body of the message")
("token", po::value<std::string>()->required(), "Application token.")
("title", po::value<std::string>(), "Title of the message.")
("message", po::value<std::string>()->required(), "Message body.")
("priority", po::value<std::int16_t>(),
"Priority of the message. Default is 5. "
"0 = no notification, 1-3 = silent, 4-7 = sound, 8-10 = popup.");
@ -58,11 +58,12 @@ void read_options(int argc, char *argv[])
message.base_url = vm["baseurl"].as<std::string>();
message.token = vm["token"].as<std::string>();
message.title = vm["title"].as<std::string>();
if (vm.count("message") != 0)
if (vm.count("title") != 0)
{
message.body = vm["message"].as<std::string>();
message.title = vm["title"].as<std::string>();
}
message.body = vm["message"].as<std::string>();
if (vm.count("priority") != 0)
{
message.priority = vm["priority"].as<std::int16_t>();