diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-09-25 15:04:12 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-09-25 15:04:12 +0200 |
commit | 2e84c80b228b77335ce44fe0f7ff1edf022d2246 (patch) | |
tree | 37ce97c0ff23d23c6c2ed5485f463e75e9b9db1e | |
parent | 11304dd4f8c0fe5f69e4431e692bcd71620a0b6e (diff) |
Really fix parsing phones in go/so.
-rwxr-xr-x | localkannel-dispatch | 12 |
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 |