List unknown numbers when adding contact

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Stacy Harper 4 years ago committed by Maarten van Gompel
parent cc81deeb10
commit 2c47c5e55f
  1. 8
      scripts/core/sxmo_contactmenu.sh
  2. 9
      scripts/core/sxmo_contacts.sh

@ -18,7 +18,7 @@ newcontact() {
name="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_usr Name")" name="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_usr Name")"
number= number=
while [ -z "$number" ]; do while [ -z "$number" ]; do
number="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_phl Number")" number="$(sxmo_contacts.sh --unknown | sxmo_dmenu_with_kb.sh -c -l 10 -p "$icon_phl Number")"
number="$(valid_number "$number")" number="$(valid_number "$number")"
done done
@ -49,14 +49,14 @@ editcontactnumber() {
oldnumber="$(echo "$1" | cut -d" " -f1)" oldnumber="$(echo "$1" | cut -d" " -f1)"
oldname="$(echo "$1" | cut -d" " -f2)" oldname="$(echo "$1" | cut -d" " -f2)"
ENTRIES="$(printf %b "Old number: $oldnumber")" ENTRIES="$(sxmo_contacts.sh --unknown | xargs -0 printf "%b (Old number)\n%b" "$oldnumber")"
PICKED= # already used var name PICKED= # already used var name
while [ -z "$PICKED" ]; do while [ -z "$PICKED" ]; do
PICKED="$( PICKED="$(
echo "$ENTRIES" | echo "$ENTRIES" |
sxmo_dmenu_with_kb.sh -c -l 3 -p "$icon_edt Edit Contact" sxmo_dmenu_with_kb.sh -c -l 10 -p "$icon_edt Edit Contact"
)" )"
if echo "$PICKED" | grep -q "^Old number: "; then if echo "$PICKED" | grep -q "(Old number)$"; then
editcontact "$1" editcontact "$1"
return return
fi fi

@ -40,8 +40,17 @@ all_contacts() {
}' "$CONTACTSFILE" | sort -f -k 2 }' "$CONTACTSFILE" | sort -f -k 2
} }
unknown_contacts() {
contacts \
| grep "Unknown Number$" \
| cut -d: -f1 \
| grep "^+[0-9]\{9,14\}$"
}
if [ "$1" = "--all" ]; then if [ "$1" = "--all" ]; then
all_contacts all_contacts
elif [ "$1" = "--unknown" ]; then
unknown_contacts
else else
contacts contacts
fi fi

Loading…
Cancel
Save