20 |
# -f send flash sms (directly to screen) |
# -f send flash sms (directly to screen) |
21 |
# -x send extended message (all output, smstools with split it in |
# -x send extended message (all output, smstools with split it in |
22 |
# multiple smses if needed) |
# multiple smses if needed) |
23 |
|
# -i hh:mm-hh:mm send sms only if it falls in this interval |
24 |
# |
# |
25 |
# it users file /usr/local/etc/sms.addressbook as addressbook in format |
# it users file /usr/local/etc/sms.addressbook as addressbook in format |
26 |
# |
# |
39 |
use strict; |
use strict; |
40 |
my %opt; |
my %opt; |
41 |
use Getopt::Std; |
use Getopt::Std; |
42 |
getopts ("S:s:g:h:t:l:uf", \%opt); |
getopts ("S:s:g:h:t:l:ufi:", \%opt); |
43 |
|
|
44 |
# read addressbook |
# read addressbook |
45 |
my %name2phone; |
my %name2phone; |
64 |
my $summary = shift @MSG; |
my $summary = shift @MSG; |
65 |
chomp $summary; |
chomp $summary; |
66 |
|
|
67 |
|
if ($opt{i}) { |
68 |
|
if ($opt{i} =~ /(\d+):(\d+)-(\d+):(\d+)/) { |
69 |
|
my $from = $1 * 60 + $2; |
70 |
|
my $to = $3 * 60 + $4; |
71 |
|
my ($sec,$min,$hour) = localtime(time); |
72 |
|
my $t = $hour * 60 + $min; |
73 |
|
exit 0 if ($t < $from || $t > $to); |
74 |
|
} else { |
75 |
|
die "interval time format: hh:mm-hh:mm" |
76 |
|
} |
77 |
|
} |
78 |
|
|
79 |
$summary = $opt{S} if $opt{S}; |
$summary = $opt{S} if $opt{S}; |
80 |
|
|
81 |
my ($wday,$mon,$day,$tm) = split (/\s+/, localtime); |
my ($wday,$mon,$day,$tm) = split (/\s+/, localtime); |