~mil/sxmo-utils

568eac7dd3c078e374a5e848692b94e7e21380ff — Stacy Harper 8 months ago 18009c8
Add a dsubmenu to reply/call on SMS windows

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
M scripts/core/sxmo_appmenu.sh => scripts/core/sxmo_appmenu.sh +8 -0
@@ 298,6 298,14 @@ programchoicesinit() {
				$icon_trm Buffer                  ^ 0 ^ type '/buffer '
			"
			WINNAME=weechat
		elif echo "$WMNAME" | grep -i -w "sms"; then
			number="$(echo "$WMNAME" | sed -e 's|^\"||' -e 's|\"$||' | cut -f1 -d' ')"
			#sms
			CHOICES="
				$icon_msg Reply          ^ 0 ^ sxmo_modemtext.sh $number
				$icon_phn Call           ^ 0 ^ sxmo_modemdial.sh $number
			"
			WINNAME=sms
		else
			STSELMODEON="$(
				echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' '

M scripts/modem/sxmo_modemdial.sh => scripts/modem/sxmo_modemdial.sh +19 -14
@@ 17,20 17,25 @@ modem_n() {
}

dialmenu() {
	CONTACTS="$(sxmo_contacts.sh | grep -E "^\+?[0-9]+:")"
	NUMBER="$(
		printf %b "Close Menu\nMore contacts\n$CONTACTS" |
		grep . |
		sxmo_dmenu_with_kb.sh -l 10 -p Number -c -i
	)"
	echo "$NUMBER" | grep "Close Menu" && kill -9 0
	if [ -n "$1" ]; then
		NUMBER="$1"
	else
		CONTACTS="$(sxmo_contacts.sh | grep -E "^\+?[0-9]+:")"
		NUMBER="$(
			printf %b "Close Menu\nMore contacts\n$CONTACTS" |
			grep . |
			sxmo_dmenu_with_kb.sh -l 10 -p Number -c -i
		)"
		echo "$NUMBER" | grep "Close Menu" && kill -9 0

		echo "$NUMBER" | grep -q "More contacts" && NUMBER="$(
			printf %b "Close Menu\n$(sxmo_contacts.sh --all)" |
			grep . |
			sxmo_dmenu_with_kb.sh -l 10 -p Number -c -i
		)"
		NUMBER="$(echo "$NUMBER" | cut -d: -f1 | tr -d -- '- ')"
	fi

	echo "$NUMBER" | grep -q "More contacts" && NUMBER="$(
		printf %b "Close Menu\n$(sxmo_contacts.sh --all)" |
		grep . |
		sxmo_dmenu_with_kb.sh -l 10 -p Number -c -i
	)"
	NUMBER="$(echo "$NUMBER" | cut -d: -f1 | tr -d -- '- ')"
	if [ -z "$NUMBER" ] || [ "$NUMBER" = "CloseMenu" ]; then
		#no number selected (probably cancelled), silently discard
		exit 0


@@ 49,7 54,7 @@ dialmenu() {
}

modem_n || fatalerr "Couldn't determine modem number - is modem online?"
CREATEDCALLID="$(dialmenu)"
CREATEDCALLID="$(dialmenu "$1")"
if [ -n "$CREATEDCALLID" ]; then
	sxmo_modemcall.sh pickup "$CREATEDCALLID"
fi

M scripts/modem/sxmo_modemmonitor.sh => scripts/modem/sxmo_modemmonitor.sh +1 -1
@@ 172,7 172,7 @@ checkfornewtexts() {

		sxmo_notificationwrite.sh \
			random \
			"st -e tail -n9999 -f '$LOGDIR/$NUM/sms.txt'" \
			"st -T '$NUM SMS' -e less +F '$LOGDIR/$NUM/sms.txt'" \
			"$LOGDIR/$NUM/sms.txt" \
			"Message - $CONTACTNAME: $TEXT"


M scripts/modem/sxmo_modemtext.sh => scripts/modem/sxmo_modemtext.sh +6 -2
@@ 108,7 108,7 @@ senddrafttextmenu() {

tailtextlog() {
	if [ "$TERMMODE" != "true" ]; then
		st -e less +F "$LOGDIR/$1/sms.txt"
		st -T "$1 SMS" -e less +F "$LOGDIR/$1/sms.txt"
	else
		less +F "$LOGDIR/$1/sms.txt"
	fi


@@ 131,4 131,8 @@ main() {
	tailtextlog "$(echo "$CONTACTIDANDNUM" | cut -d: -f1)"
}

main
if [ -n "$1" ]; then
	sendnewtextmenu "$1"
else
	main
fi