-
Notifications
You must be signed in to change notification settings - Fork 0
/
qrsd
executable file
·58 lines (38 loc) · 1.16 KB
/
qrsd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl
use 5.10.0;
use strict;
use warnings;
use local::lib;
use Getopt::Long;
use Pod::Usage;
use Config::Std;
use AnyEvent;
=head1 NAME
qrs - Quick-and-dirty Reminder System
=head1 SYNOPSIS
qrs --config /path/to/qrs.cfg
=head1 DESCRIPTION
This program connects to a Jabber server, and waits for commands
from allowed users.
=cut
use Qrs;
my $j = AnyEvent->condvar;
$SIG{'INT'} = sub { $j->broadcast };
{
my $cfgfile;
GetOptions("config=s" => \$cfgfile) or pod2usage();
defined($cfgfile) or pod2usage();
-r $cfgfile or die("Configuration file not found\n");
read_config $cfgfile => my %cfg;
-d $cfg{core}{store} or die("$cfgfile 'store' is not a valid directory\n");
# Turn a single client into an arrayref:
$cfg{core}{client} = [$cfg{core}{client}] unless (ref($cfg{core}{client}));
my $qrs = new Qrs(user => $cfg{core}{user},
password => $cfg{core}{password},
server => $cfg{core}{server},
client => $cfg{core}{client},
store => $cfg{core}{store},
signal => $j,
);
}
$j->wait;