diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-09-25 16:29:14 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-09-25 16:29:14 +0200 |
commit | c12213ecfc5a89bf25805046d5dee7a84e40f674 (patch) | |
tree | 2769c0bc141f7d415b521fe2f976c928652d192c /localkannel-dispatch | |
parent | a09e52546fcf70add5e3f2883be0b4587e6a716c (diff) |
Extend action /add to send out trailing message.
Diffstat (limited to 'localkannel-dispatch')
-rwxr-xr-x | localkannel-dispatch | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/localkannel-dispatch b/localkannel-dispatch index 4f801d9..36b350f 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -74,6 +74,8 @@ case "$SMS_REALM" in ;; hellobudapest) provider="clickatell" + addtestphones="" + addphones="" gotestphones="" gophones="" SMS_ERRFROM="+36307418279" # Jonas @@ -209,7 +211,7 @@ Respond \"pong\" and echo back any addition input." $sbindir/localsendsms "$to" pong "$@" exit 0 ;; - add) + add|addtest) if [ "help" = "$1" ]; then $sbindir/localsendsms "$to" "Usage: /add ID PHONE [MSG]...] @@ -232,8 +234,27 @@ and (if included) send MSG to subscribers." phone="+$phone" shift + case "$cmd" in + addtest) + msgphones="$addtestphones" + ;; + add) + msgphones="$addphones" + ;; + esac + str=$($sbindir/localsmsadmin add user "$id" "$phone") $sbindir/localsendsms "$to" "[info] \"$cmd\": $str." + + if [ -n "$*" ]; then + for msgphone in $msgphones; do + $sbindir/localsendsms "$msgphone" "[info] $id $phone $@" + done + $sbindir/localsendsms "$to" "[info] $id $phone added/updated. trailing message forwarded to subscribers." + else + $sbindir/localsendsms "$to" "[info] $id $phone added/updated. (no trailing message passed to subscribers)." + fi + exit 0 ;; # FIXME: generalize this ugly hacks somehow, and secure against random use |