From 568eac7dd3c078e374a5e848692b94e7e21380ff Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Sat, 27 Mar 2021 14:40:54 +0100 Subject: [PATCH] Add a dsubmenu to reply/call on SMS windows Signed-off-by: Stacy Harper Signed-off-by: Maarten van Gompel --- scripts/core/sxmo_appmenu.sh | 8 ++++++++ scripts/modem/sxmo_modemdial.sh | 33 +++++++++++++++++------------- scripts/modem/sxmo_modemmonitor.sh | 2 +- scripts/modem/sxmo_modemtext.sh | 8 ++++++-- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 5028366..fdabacf 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -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 ' ' diff --git a/scripts/modem/sxmo_modemdial.sh b/scripts/modem/sxmo_modemdial.sh index 83b213b..9ace65d 100755 --- a/scripts/modem/sxmo_modemdial.sh +++ b/scripts/modem/sxmo_modemdial.sh @@ -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 diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 90c1a62..570c46b 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -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" diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index e32fd87..c59c47b 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -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