summaryrefslogtreecommitdiff
path: root/localmarkdown2sms
diff options
context:
space:
mode:
authorroot <root@jones.dk>2009-10-24 15:19:08 +0200
committerroot <root@jones.dk>2009-10-24 15:19:08 +0200
commit9adbf437e2886e01943e658fd7c88819fb321666 (patch)
tree09604a1f09e2379165dccfd44402899fdeced77e /localmarkdown2sms
parent3be9849d8548d1af073a6d3db21cd15e2172604d (diff)
Add env flag urldecode to unescape variables from kannel.
Diffstat (limited to 'localmarkdown2sms')
-rwxr-xr-xlocalmarkdown2sms13
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/;