summaryrefslogtreecommitdiff
path: root/lib/App/smsg/Command/Status.pm
blob: 019cd5b93c5c8ecebbdf4f2342e6830b3f2b94fb (plain)
  1. package App::smsg::Command::Status;
  2. use 5.010;
  3. use strict;
  4. use warnings;
  5. use utf8;
  6. BEGIN {
  7. $App::smsg::Command::Status::AUTHORITY = 'https://dr.jones.dk/me#me';
  8. $App::smsg::Command::Status::VERSION = '0.001';
  9. }
  10. use App::smsg -command;
  11. use namespace::clean;
  12. use NetSDS::Kannel;
  13. #use Coro;
  14. use constant abstract => q (Check status of platform(s).);
  15. use constant usage_desc => '%c status %o <platform>...';
  16. use constant description => <<'DESCRIPTION';
  17. Connect to one or more platforms (Kannel, Jabber, IRC etc.) and check
  18. operational status.
  19. DESCRIPTION
  20. use constant opt_spec => (
  21. ['kannelserver=s', "the Kannel server to connect to",
  22. {default => 'localhost'}],
  23. ['kannelport=i', "the Kannel port to connect to",
  24. {default => 13013}],
  25. ['kanneluser=s', "the Kannel users to authenticate as",
  26. {default => 'tester'}],
  27. ['kannelpasswd=s', "the Kannel password to authenticate with",
  28. {default => 'foobar'}],
  29. ['kannelsmsc=s', "the Kannel SMSC to correspond with"],
  30. [],
  31. # [ 'verbose|v', "print extra stuff"],
  32. [ 'debug', "print debug stuff"],
  33. );
  34. sub execute {
  35. my ($self, $opt, $args) = @_;
  36. # TODO: support overriding full URL
  37. # TODO: use URI module to construct URL
  38. my $kannel = NetSDS::Kannel->new(
  39. sendsms_url => 'http://' . $opt->kannelserver . ':' . $opt->kannelport . '/cgi-bin/sendsms',
  40. sendsms_user => $opt->kanneluser,
  41. sendsms_passwd => $opt->kannelpasswd,
  42. default_smsc => $opt->kannelsmsc,
  43. );
  44. die 'FIXME: unimplemented!';
  45. }
  46. 1;