diff options
-rwxr-xr-x | localkannel-dispatch | 2 | ||||
-rwxr-xr-x | localsmsadmin | 38 |
2 files changed, 40 insertions, 0 deletions
diff --git a/localkannel-dispatch b/localkannel-dispatch index d92b29a..fa22856 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -155,6 +155,8 @@ case "$app" in ;; esac +#FIXME: if sender has a mission, check for "done": process missionpending and report result to mission members + # yb) # s="$(links -dump "http://www.yubnub.org/parser/parse?command=$@")" # $sbindir/localsendsms "$to" "$s" diff --git a/localsmsadmin b/localsmsadmin index 3fb6d07..0fb6fc8 100755 --- a/localsmsadmin +++ b/localsmsadmin @@ -328,11 +328,49 @@ EOF # ;; # esac # ;; + mission) + case "$1" in + help) + cat <<EOF +Usage: +/mission AGENT @VICTIM msg... + +Send AGENT contact info on VICTIM. +When AGENT responds "done", msg is sent on behalf of VICTIM. +EOF +#TODO: Store mission as an object: +# Has an owner +# Can have subscribers who get progress info +# msg is stored in mission, is optional, and originator is mission owner (i.e. sending on behalf of victim is optional) + exit 0 + ;; + *) + agent="$1"; [ -n "$agent" ] || exit1 "Missing agent (try \"/mission help\" for usage info)!"; shift +#FIXME: strip leading @ from victim + victim="$1"; [ -n "$victim" ] || exit1 "Missing victim (try \"/mission help\" for usage info)!"; shift + [ -n "$*" ] || exit1 "Missing message (try \"/mission help\" for usage info)!" + agentname="$(findobjects user "$agent")"; [ -n "$agentname" ] || exit1 "Unknown agent \"$agent\" (try \"/mission help\" for usage info)!" + victimname="$(findobjects user "$victim")"; [ -n "$victimname" ] || exit1 "Unknown victim \"$victim\" (try \"/mission help\" for usage info)!" + victimphone="$(getitem user "$victim" phone)"; [ -n "$victimphone" ] || exit1 "Failed resolving victim phone to provide to agent." + task="Contact $victimname ($victimphone). When done send text: done" +#FIXME: store mission msg as missionpending item at agent user +#FIXME: send mission task to agent + cat <<EOF +Mission initiated: +$agentname: $task + +($@) +EOF + exit 0 + ;; + esac + ;; help) cat <<EOF Admin commands: /add user|group|session|default ... /del user|group|session|default ... +/mission AGENT @VICTIM msg... /COMMAND help try e.g. "/del help". |