Add more contacts choice to contact list

The dialer only included recent callers, but there was no way to access
the full contact list (contacts.tsv). I added a "more contacts" options
that calls sxmo_contacts --all, providing an alphabetically sorted list
of all your contacts. It also works for the texting menu.

This is a cleaned up version of an earlier patch by Maarten van Gompel.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Reed Wade 4 years ago committed by Maarten van Gompel
parent 0e4406bffa
commit 65d9d60ff1
  1. 12
      scripts/core/sxmo_contacts.sh
  2. 11
      scripts/modem/sxmo_modemdial.sh
  3. 11
      scripts/modem/sxmo_modemtext.sh

@ -28,4 +28,14 @@ contacts() {
' "$CONTACTSFILE" -
}
contacts
all_contacts() {
cat "$CONTACTSFILE" | awk -F'\t' '{
if (substr($0,1,1) == "+") print $1 ": " $2
}' | sort -f -k 2
}
if [ "$1" = "--all" ]; then
all_contacts
else
contacts
fi

@ -18,7 +18,12 @@ modem_n() {
dialmenu() {
CONTACTS="$(sxmo_contacts.sh)"
NUMBER="$(
printf %b "Close Menu\n$CONTACTS" |
printf %b "Close Menu\nMore contacts\n$CONTACTS" |
grep . |
sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i
)"
echo "$NUMBER" | grep "More contacts" && NUMBER="$(
printf %b "Close Menu\n$(sxmo_contacts.sh --all)" |
grep . |
sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i
)"
@ -29,8 +34,8 @@ dialmenu() {
echo "Attempting to dial: $NUMBER" >&2
CALLID="$(
mmcli -m "$(modem_n)" --voice-create-call "number=$NUMBER" |
grep -Eo "Call/[0-9]+" |
mmcli -m "$(modem_n)" --voice-create-call "number=$NUMBER" |
grep -Eo "Call/[0-9]+" |
grep -oE "[0-9]+"
)"
echo "Starting call with CALLID: $CALLID" >&2

@ -38,13 +38,20 @@ choosenumbermenu() {
# Prompt for number
NUMBER="$(
printf %b "\nCancel\n$(sxmo_contacts.sh)" |
printf %b "\nCancel\nMore contacts\n$(sxmo_contacts.sh)" |
awk NF |
menu sxmo_dmenu_with_kb.sh -p "Number" -fn "Terminus-20" -l 10 -c -i |
cut -d: -f1 |
tr -d -- '- '
)"
echo "$NUMBER" | grep -E "^Cancel$" && exit 1
echo "$NUMBER" | grep -qE "^Morecontacts$" && NUMBER="$( #joined words without space is not a bug
printf %b "\nCancel\n$(sxmo_contacts.sh --all)" |
grep . |
sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i
cut -d: -f1 |
tr -d -- '- '
)"
echo "$NUMBER" | grep -qE "^Cancel$" && exit 1
echo "$NUMBER" | grep -qE '^[+0-9]+$' || err "That doesn't seem like a valid number"
echo "$NUMBER"
}

Loading…
Cancel
Save