From 9adbf437e2886e01943e658fd7c88819fb321666 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 Oct 2009 15:19:08 +0200 Subject: Add env flag urldecode to unescape variables from kannel. --- localmarkdown2sms | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'localmarkdown2sms') 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/; -- cgit v1.2.3