summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalkannel-dispatch55
1 files changed, 55 insertions, 0 deletions
diff --git a/localkannel-dispatch b/localkannel-dispatch
index 792b561..0e69cfb 100755
--- a/localkannel-dispatch
+++ b/localkannel-dispatch
@@ -191,6 +191,61 @@ Respond \"pong\" and echo back any addition input."
$sbindir/localsendsms "$to" pong "$@"
exit 0
;;
+# FIXME: generalize these ugly hacks somehow, and secure against random use
+ gone)
+ if [ "help" = "$1" ]; then
+ $sbindir/localsendsms "$to" "Usage:
+/gone PHONE MSG...
+
+Start thread \"gone\" on behalf of PHONE.
+Send \"[gone] MSG\" to Alessandra and Vela."
+ exit 0
+ fi
+ [ -n "$1" ] || exit1 "phone number missing (try \"/gone help\" for usage)"
+ [ -n "$2" ] || exit1 "message missing (try \"/gone help\" for usage)"
+ targetphone="$(echo "$1" | perl -pe 's/^@//;' -e 's/^([^+])/+39\1/')"; shift
+ info1phone="+393273009765" # Alessandra
+ info2phone="+393276733618" # Vela
+ targetfrom=$(lastservicephone "$targetphone")
+ [ -n "$targetfrom" ] || exit1 "refusing to redirect: unknown target phone number \"$targetphone\"."
+ info1from=$(lastservicephone "$info1phone")
+ [ -n "$info1from" ] || exit1 "refusing to redirect: unknown info phone number \"$info1phone\"."
+ info2from=$(lastservicephone "$info2phone")
+ [ -n "$info2from" ] || exit1 "refusing to redirect: unknown info phone number \"$info2phone\"."
+ SMS_PHONE="$targetfrom" $sbindir/localmarkdown2sms "$targetphone" "/gone"
+ SMS_PHONE="$info1from" $sbindir/localmarkdown2sms "$info1phone" "[gone] $@"
+ SMS_PHONE="$info2from" $sbindir/localmarkdown2sms "$info2phone" "[gone] $@"
+ exit 0
+ ;;
+ gonetest)
+ if [ "help" = "$1" ]; then
+ $sbindir/localsendsms "$from" "Usage:
+/gone PHONE MSG...
+
+Start thread \"gone\" on behalf of PHONE.
+Report MSG to Jonas, Jacob and Vera."
+ exit 0
+ fi
+ [ -n "$1" ] || exit1 "phone number missing (try \"/gone help\" for usage)"
+ [ -n "$2" ] || exit1 "message missing (try \"/gone help\" for usage)"
+ targetphone="$(echo "$1" | perl -pe 's/^@//;' -e 's/^([^+])/+39\1/')"; shift
+ info1phone="+393453915741" # Jonas
+ info2phone="+393453805531" # Jacob
+ info3phone="+393453801457" # Vera
+ targetfrom=$(lastservicephone "$targetphone")
+ [ -n "$targetfrom" ] || exit1 "refusing to redirect: unknown target phone number \"$targetphone\"."
+ info1from=$(lastservicephone "$info1phone")
+ [ -n "$info1from" ] || exit1 "refusing to redirect: unknown info phone number \"$info1phone\"."
+ info2from=$(lastservicephone "$info2phone")
+ [ -n "$info2from" ] || exit1 "refusing to redirect: unknown info phone number \"$info2phone\"."
+ info3from=$(lastservicephone "$info3phone")
+ [ -n "$info3from" ] || exit1 "refusing to redirect: unknown info phone number \"$info3phone\"."
+ SMS_PHONE="$targetfrom" $sbindir/localmarkdown2sms "$targetphone" "/gone"
+ SMS_PHONE="$info1from" $sbindir/localmarkdown2sms "$info1phone" "[gone] $@"
+ SMS_PHONE="$info2from" $sbindir/localmarkdown2sms "$info2phone" "[gone] $@"
+ SMS_PHONE="$info3from" $sbindir/localmarkdown2sms "$info3phone" "[gone] $@"
+ exit 0
+ ;;
esac
candidates=$(cd "$vardir/user" && grep -lF "$to" */phone | perl -pe "s,/phone$,,") || candidates=
[ -z "$candidates" ] || $(grep -vqF "$candidates" "$vardir/group/admin/user") || admin=true