From ad39251c5d46c9fb0fd600210e7f15d00e63edec Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Mon, 29 Jun 2020 15:37:33 -0500 Subject: [PATCH] Show incoming contact name on ring; show texts in reverse chronological order --- scripts/core/sxmo_appmenu.sh | 15 +++++++++++---- scripts/modem/sxmo_modemtext.sh | 5 +++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index f506daa..bdc9917 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -208,10 +208,17 @@ getprogchoices() { # Decorate menu at top w/ incoming call entry if present INCOMINGCALL="$(cat /tmp/sxmo_incomingcall || echo NOCALL)" - echo "$INCOMINGCALL" | grep -v NOCALL && CHOICES=" - Pickup $(echo "$INCOMINGCALL" | cut -d: -f2) ^ 0 ^ sxmo_modemcall.sh pickup $(echo "$INCOMINGCALL" | cut -d: -f1) - $CHOICES - " + if echo "$INCOMINGCALL" | grep -v NOCALL; then + CALLID="$(echo "$INCOMINGCALL" | cut -d: -f1)" + CALLNUM="$(echo "$INCOMINGCALL" | cut -d: -f2)" + CALLCONTACT="$(sxmo_contacts.sh | grep -v "Unknown Number" | grep -m1 "$CALLNUM" | cut -d: -f2)" + CHOICES=" + Pickup: $( + [ -n "$CALLCONTACT" ] && echo "$CALLCONTACT" || echo "$CALLNUM" + ) ^ 0 ^ sxmo_modemcall.sh pickup $CALLID + $CHOICES + " + fi # Decorate menu at bottom w/ system menu entry if not system menu echo $WINNAME | grep -v Sys && CHOICES=" diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index adbc6a3..1334a23 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -80,8 +80,9 @@ main() { # E.g. only display logfiles for directories that exist and join w contact name ENTRIES="$( printf %b "Close Menu\nSend a Text\n"; - for TDIR in "$LOGDIR"/*; do - [ -d "$TDIR" ] || continue + # shellcheck disable=SC2045 + for TDIR in $(ls -1 -t "$LOGDIR"); do + [ -d "$LOGDIR"/"$TDIR" ] || continue NUM="$(basename "$TDIR")" sxmo_contacts.sh | grep -m1 "$NUM" | xargs -IL echo "L logfile" done