normalize smslog for mms and sms

This implements sxmo_hook_smslog.sh which allows the user to establish
how logging looks.

We were also inconsistent on this: mms would set the contact names in
the logfile whereas sms ony gave the numbers and used a sed to convert
them.

I tought about setting this in sxmo_hook_tailtextlog.sh, but:

(1) processing on a tail is a PITA
(2) one can get the "raw" data for sms.txt from modelog.tsv.

I implemented a basic and a fancy option, but it is really up to the
user.

I also implemented sxmo_contacts.sh --name-or-number and so was able to
clear out the '???' code all over the place.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:
Peter John Hartman
2023-02-27 21:35:19 -06:00
committed by Willow Barraco
parent 7f78a92b18
commit d27f7e108d
8 changed files with 151 additions and 45 deletions

View File

@@ -108,6 +108,14 @@ elif [ "$1" = "--me" ]; then
all_contacts \
| grep "^Me: " \
| sed 's|^Me: ||'
elif [ "$1" = "--name-or-number" ]; then
if [ -z "$2" ]; then
printf "???\n"
else
contact="$(sxmo_contacts.sh --name "$2")"
[ "$contact" = "???" ] && contact="$2"
printf %s "$contact"
fi
elif [ "$1" = "--name" ]; then
if [ -z "$2" ]; then
printf "???\n"