summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalkannel-dispatch12
1 files changed, 8 insertions, 4 deletions
diff --git a/localkannel-dispatch b/localkannel-dispatch
index e9564db..91e5577 100755
--- a/localkannel-dispatch
+++ b/localkannel-dispatch
@@ -47,6 +47,7 @@ lastservicephone() {
from=`uriunescape "$1"`; shift
#to=`uriunescape "$1" | sed -e 's/\+/ /g'`; shift
to=`uriunescape "$1"`; shift
+# FIXME: avoid stripping ALL plusses
set -- `uriunescape "$@" | sed -e 's/\+/ /g'`
#set -- `uriunescape "$@"`
app_raw="$1"
@@ -239,16 +240,19 @@ and (if included) send MSG to subscribers."
phones="$gophones"
;;
esac
+# FIXME: avoid juggling with leading plus here when no longer stripped from input
+# FIXME: make country code optional again when plus no longer stripped from input
# FIXME: Avoid hardcoding national prefix
while [ -n "$1" ]; do
- targetphone="$(echo "$1" | perl -pe 's/^(?=[^+])/+36/;' -e '/^\+\d+$/;')"
+# targetphone="$(echo "$1" | perl -ne 's/^(?=[^+])/+36/;' -e '/^(\+\d\d\d+)$/ and print $1;')"
+ targetphone="$(echo "$1" | perl -ne '/^(\d\d\d+)$/ and print $1;')"
[ -n "$targetphone" ] || continue
# Sanity check
- targetfrom=$(lastservicephone "$targetphone")
- [ -n "$targetfrom" ] || exit1 "refusing to redirect: unknown target phone number \"$targetphone\"."
+ targetfrom=$(lastservicephone "\+$targetphone")
+ [ -n "$targetfrom" ] || exit1 "refusing to redirect: unknown target phone number +$targetphone."
- targetphones="${targetphones:+$targetphones }$targetphone"
+ targetphones="${targetphones:+$targetphones }\+$targetphone"
shift
done