~mil/sxmo-utils

30bc33942017b4751358cfc8fb1cb47e359a40a6 — Stacy Harper 2 months ago c33e54e
Add a conversation loop to convers with contact by sms

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2 files changed, 25 insertions(+), 0 deletions(-)

M scripts/core/sxmo_appmenu.sh
M scripts/modem/sxmo_modemtext.sh
M scripts/core/sxmo_appmenu.sh => scripts/core/sxmo_appmenu.sh +1 -0
@@ 392,6 392,7 @@ programchoicesinit() {
			number="$(printf %s "$WMNAME" | sed -e 's|^\"||' -e 's|\"$||' | cut -f1 -d' ')"
			#sms
			CHOICES="
				$icon_msg Conversation   ^ 0 ^ sxmo_terminal.sh sxmo_modemtext.sh conversationloop $number
				$icon_msg Reply          ^ 0 ^ sxmo_modemtext.sh sendtextmenu $number
				$icon_phn Call           ^ 0 ^ sxmo_modemdial.sh $number
				$icon_aru Scroll up       ^ 1 ^ sxmo_type -M Shift -M Ctrl b

M scripts/modem/sxmo_modemtext.sh => scripts/modem/sxmo_modemtext.sh +24 -0
@@ 71,6 71,30 @@ sendtextmenu() {
	done
}

conversationloop() {
	if [ -n "$1" ]; then
		NUMBER="$1"
	else
		NUMBER="$(choosenumbermenu)"
	fi

	set -e

	sxmo_keyboard.sh open

	while true; do
		DRAFT="$LOGDIR/$NUMBER/draft.txt"
		if [ ! -f "$DRAFT" ]; then
			mkdir -p "$(dirname "$DRAFT")"
			touch "$DRAFT"
		fi

		"$EDITOR" "$DRAFT"
		sxmo_modemsendsms.sh "$NUMBER" - < "$DRAFT" || continue
		rm "$DRAFT"
	done
}

tailtextlog() {
	NUMBER="$1"
	CONTACTNAME="$(sxmo_contacts.sh | grep "^$NUMBER" | cut -d' ' -f2-)"