Benjamin Renard commited on 2012-11-29 16:00:00
Showing 1 changed files, with 12 additions and 3 deletions.
| ... | ... |
@@ -9,7 +9,7 @@ |
| 9 | 9 |
# in master.cf : |
| 10 | 10 |
# |
| 11 | 11 |
# sms unix - n n - 1 pipe |
| 12 |
-# flags=Rq user=gnokii:dialout argv=/usr/local/sbin/mail2gnokii ${user}
|
|
| 12 |
+# flags=Rq user=gnokii:dialout argv=/usr/local/sbin/mail2gnokii ${user} [SMSC]
|
|
| 13 | 13 |
# |
| 14 | 14 |
# in transport : |
| 15 | 15 |
# |
| ... | ... |
@@ -39,8 +39,8 @@ use constant {
|
| 39 | 39 |
}; |
| 40 | 40 |
|
| 41 | 41 |
|
| 42 |
-if($#ARGV + 1 != 1){
|
|
| 43 |
- print "Usage : mail2gnokii [phone number]"; |
|
| 42 |
+if($#ARGV + 1 != 1 and $#ARGV + 1 != 2){
|
|
| 43 |
+ print "Usage : mail2gnokii [phone number] [SMSC phone number]"; |
|
| 44 | 44 |
exit EX_USAGE; |
| 45 | 45 |
} |
| 46 | 46 |
|
| ... | ... |
@@ -84,6 +84,15 @@ if (not $mob =~ m/^[0-9]*$/) {
|
| 84 | 84 |
exit EX_DATAERR; |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 |
+# recuperation du numero du SMSC (si present) |
|
| 88 |
+if (defined $ARGV[1]) {
|
|
| 89 |
+ if (not $ARGV[1]=~ m/^[0-9\+]*$/) {
|
|
| 90 |
+ print "Invalid SMSC phone number : "+$ARGV[1]; |
|
| 91 |
+ exit EX_DATAERR; |
|
| 92 |
+ } |
|
| 93 |
+ $smsc=$ARGV[1]; |
|
| 94 |
+} |
|
| 95 |
+ |
|
| 87 | 96 |
sub in_array {
|
| 88 | 97 |
my ($arr,$search_for) = @_; |
| 89 | 98 |
my %items = map {$_ => 1} @$arr; # create a hash out of the array values
|
| 90 | 99 |