diff options
author | root <root@jones.dk> | 2009-10-24 15:19:08 +0200 |
---|---|---|
committer | root <root@jones.dk> | 2009-10-24 15:19:08 +0200 |
commit | 9adbf437e2886e01943e658fd7c88819fb321666 (patch) | |
tree | 09604a1f09e2379165dccfd44402899fdeced77e /localmarkdown2sms | |
parent | 3be9849d8548d1af073a6d3db21cd15e2172604d (diff) |
Add env flag urldecode to unescape variables from kannel.
Diffstat (limited to 'localmarkdown2sms')
-rwxr-xr-x | localmarkdown2sms | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/localmarkdown2sms b/localmarkdown2sms index 06aa589..215f010 100755 --- a/localmarkdown2sms +++ b/localmarkdown2sms @@ -23,7 +23,7 @@ use strict; use warnings; -use Env qw[$debug $info $warn $dummy $nosleep]; +use Env qw[$debug $info $warn $dummy $nosleep $urldecode]; use Log::Log4perl qw(:easy); use File::Spec; use File::Slurp; @@ -47,6 +47,17 @@ my ($path) = shift @ARGV; my ($phone) = shift @ARGV; my ($key) = lc (shift @ARGV); +# decode data passed from kannel +if ($urldecode) { + $phone = uri_unescape($phone); + $key = uri_unescape($phone); + @ARGV = uri_unescape(@ARGV); +} + +# strip international prefix +# (prefix is optional some places and illegal at other places - forgot where) +$phone =~ s/\+/ /g; + # strip non-word chars from keyword (and use only first chunk of word chars) $key =~ s/.*?(\w+).*?/$1/; |