summaryrefslogtreecommitdiff
path: root/lib/App/smsg/Command/Status.pm
blob: f0dfb70d16f091af7707de0787c0fa46546bf6ad (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. ['f|follow', "keep connection open and emit each change of state"],
  32. [],
  33. # [ 'verbose|v', "print extra stuff"],
  34. [ 'debug', "print debug stuff"],
  35. );
  36. sub execute {
  37. my ($self, $opt, $args) = @_;
  38. # TODO: support overriding full URL
  39. # TODO: use URI module to construct URL
  40. my $kannel = NetSDS::Kannel->new(
  41. sendsms_url => 'http://' . $opt->kannelserver . ':' . $opt->kannelport . '/cgi-bin/sendsms',
  42. sendsms_user => $opt->kanneluser,
  43. sendsms_passwd => $opt->kannelpasswd,
  44. default_smsc => $opt->kannelsmsc,
  45. );
  46. die 'FIXME: unimplemented!';
  47. }
  48. 1;