summaryrefslogtreecommitdiff
path: root/localsmsadmin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-07-07 23:58:01 +0200
committerJonas Smedegaard <dr@jones.dk>2010-07-07 23:58:01 +0200
commit248cbc59d6cb32af51ce210c2a945eaeea96bd6e (patch)
treeee68387f8b1c0b98ca749b3aa544341becb66469 /localsmsadmin
parent7193c2c0de0849dad1af6631a7ea9bf289d735b2 (diff)
Add more of (still untested) "mission" command to localsmsadmin.
Diffstat (limited to 'localsmsadmin')
-rwxr-xr-xlocalsmsadmin8
1 files changed, 5 insertions, 3 deletions
diff --git a/localsmsadmin b/localsmsadmin
index ec891d6..8e1e6da 100755
--- a/localsmsadmin
+++ b/localsmsadmin
@@ -64,6 +64,7 @@ finditems() {
}
getitem() {
set -e
+set -x
type="$1"; [ -n "$type" ] || exit1 "Internal error (getitem: empty type)!"; shift
name="$1"; [ -n "$name" ] || exit1 "Internal error (getitem: empty name)!"; shift
item="$1"; [ -n "$item" ] || exit1 "Internal error (getitem: empty item)!"; shift
@@ -350,11 +351,12 @@ EOF
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)!"
+ agentphone="$(getitem user "$agent" phone)"; [ -n "$agentphone" ] || exit1 "Failed resolving agent phone number."
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."
+ victimphone="$(getitem user "$victim" phone)"; [ -n "$victimphone" ] || exit1 "Failed resolving victim phone number."
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
+ str=$(additem user "$agentname" "pendingmission" "@$victimname $*") || exit1 "$str"
+ $sbindir/localsendsms "$agentphone" "$task"
cat <<EOF
Mission initiated:
$agentname: $task