sxmo-utils: Allow user to block texts from numbers with block.tsv config file v1 SUPERSEDED

Anjandev Momi: 1
 Allow user to block texts from numbers with block.tsv config file

 2 files changed, 13 insertions(+), 0 deletions(-)
#593851 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/sxmo-devel/patches/25332/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH sxmo-utils] Allow user to block texts from numbers with block.tsv config file Export this patch

 scripts/core/sxmo_common.sh        | 4 ++++
 scripts/modem/sxmo_modemmonitor.sh | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/scripts/core/sxmo_common.sh b/scripts/core/sxmo_common.sh
index 7441231..8c5e773 100644
--- a/scripts/core/sxmo_common.sh
+++ b/scripts/core/sxmo_common.sh
@@ -28,10 +28,14 @@ export CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"/sxmo
# shellcheck disable=SC2034
export LOGDIR="${XDG_DATA_HOME:-$HOME/.local/share}"/sxmo/modem
# shellcheck disable=SC2034
export BLOCKDIR="${XDG_DATA_HOME:-$HOME/.local/share}"/sxmo/block
# shellcheck disable=SC2034
# shellcheck disable=SC2034
export CONTACTFILE="$XDG_CONFIG_HOME/sxmo/contacts.tsv"
# shellcheck disable=SC2034
export BLOCKFILE="$XDG_CONFIG_HOME/sxmo/block.tsv"
# shellcheck disable=SC2034
export UNSUSPENDREASONFILE="$XDG_RUNTIME_DIR/sxmo.suspend.reason"
# shellcheck disable=SC2034
export LASTSTATE="$XDG_RUNTIME_DIR/sxmo.suspend.laststate"
diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh
index 1446236..b89a93f 100755
--- a/scripts/modem/sxmo_modemmonitor.sh
+++ b/scripts/modem/sxmo_modemmonitor.sh
@@ -196,6 +196,15 @@ checkfornewtexts() {
		NUM="$(cleanupnumber "$NUM")"
		TIME="$(echo "$TEXTDATA" | grep sms.properties.timestamp | sed -E 's/^sms\.properties\.timestamp\s+:\s+//')"

		if grep -q "$NUM" "$BLOCKFILE"; then
			mkdir -p "$BLOCKDIR/$NUM"
			echo "sxmo_modemmonitor: BLOCKED text from number: $NUM (TEXTID: $TEXTID)">&2
			printf %b "Received from $NUM at $TIME:\n$TEXT\n\n" >> "$BLOCKDIR/$NUM/sms.txt"
			printf %b "$TIME\trecv_txt\t$NUM\t${#TEXT} chars\n" >> "$BLOCKDIR/modemlog.tsv"
			mmcli -m "$(modem_n)" --messaging-delete-sms="$TEXTID"

		mkdir -p "$LOGDIR/$NUM"
		echo "sxmo_modemmonitor: Text from number: $NUM (TEXTID: $TEXTID)">&2
		printf %b "Received from $NUM at $TIME:\n$TEXT\n\n" >> "$LOGDIR/$NUM/sms.txt"
sxmo-utils/patches/.build.yml: SUCCESS in 25s

[Allow user to block texts from numbers with block.tsv config file][0] from [Anjandev Momi][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/25332
[1]: mailto:anjan@momi.ca

✓ #593851 SUCCESS sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/593851