From c12213ecfc5a89bf25805046d5dee7a84e40f674 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 25 Sep 2010 16:29:14 +0200 Subject: Extend action /add to send out trailing message. --- localkannel-dispatch | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'localkannel-dispatch') 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 -- cgit v1.2.3