summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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/;