]>
iEval git - app-remotegnokii.git/blob - lib/App/RemoteGnokii.pm
1 package App
:: RemoteGnokii
;
6 our $VERSION = '0.000_001' ;
7 $VERSION = eval $VERSION ;
10 use File
:: Copy qw
/move/ ;
11 use File
:: Temp qw
/tempfile/ ;
18 $cfg = Config
:: Any
-> load_stems ({ stems
=> [ $ENV { RGCONFIG
} // '/etc/rg' ], use_ext
=> 1 , flatten_to_hash
=> 1 });
19 my @cfg = values % $cfg ;
27 my ( $number , $text ) = @_ ;
28 my ( $fh , $file ) = tempfile
'smsXXXX' , TMPDIR
=> 1 ;
29 print $fh " $number \n $text " ;
31 move
$file , cfg
'spool' ;
34 ##################################################
37 my ( $number , $date , $text ) = @_ ;
38 my $password = cfg
'password' ;
39 sendsms cfg
'number' , <<EOF
48 my $correct_password = cfg
'password' ;
50 my $r = Plack
:: Request
-> new ( shift );
51 my @numbers = split ',' , $r -> param ( 'numbers' );
52 my $password = $r -> param ( 'password' );
53 return [ 403 , [ 'Content-Type' , 'text/plain' ], [ 'Bad password' ]] unless $password eq $correct_password ;
54 my $text = $r -> param ( 'text' );
56 sendsms
$_ , $text for @numbers
67 App::RemoteGnokii - Send SMS over the internet with gnokii-smsd
71 use App::RemoteGnokii;
72 my $config_option = App::RemoteGnokii::cfg 'name';
73 App::RemoteGnokii::sendsms '0755555555', 'Hello world';
74 App::RemoteGnokii::action('0755555555', '2014-02-01', 'Goodbye');
78 RemoteGnokii is a set of scripts that add networking to gnokii-smsd. With them, all messages received are forwarded to a given phone number, and messages can be sent via the HTTP gateway provided by RemoteGnokii.
80 =head1 CONFIGURATION OPTIONS
82 See below for the location of the configuration file. The following options are recognised:
88 Forward incoming messages to this number (used by L<rg-action>).
92 The password needed to send a message with L<rg-psgi> and included in forwarded messages.
96 The gnokii-smsd spool directory. Needs to be readable and writable by gnokii-smsd and L<rg-psgi>.
106 The basename of the configuration file. For example, if the configuration file is '/srv/rg/config.yml', RGCONF should be set to '/srv/rg/config'. Defaults to '/etc/rg'.
114 =item Write a section 7 manpage explaining everything
118 =item Add a way to store messages for later retrieval via the webapp, instead of sending them immediately via SMS
124 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
126 =head1 COPYRIGHT AND LICENSE
128 Copyright (C) 2014 by Marius Gavrilescu
130 This library is free software: you can redistribute it and/or modify
131 it under the terms of the GNU General Public License as published by
132 the Free Software Foundation, either version 3 of the License, or (at
133 your option) any later version.
This page took 0.052955 seconds and 4 git commands to generate.