Add Gambatte GB/GBC emulator, Call/SMS anti-spam blocklist, and Lua/bc/dc/Yabasic
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,57 @@
|
||||
#!/bin/sh
|
||||
# configversion: 4408f29a464ab22d7c978fa0475cf80e
|
||||
|
||||
# This hook is executed to check if a call should be blocked
|
||||
# If the hook return 0 the call will be blocked
|
||||
# This hook is executed to check if a call or SMS should be blocked.
|
||||
# If the hook returns 0 the call/SMS will be blocked.
|
||||
|
||||
INCOMINGNUMBER="$1"
|
||||
BLOCKFILE="${SXMO_BLOCKFILE:-${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/block.tsv}"
|
||||
|
||||
cut -f1 "$SXMO_BLOCKFILE" 2>/dev/null | grep -q "^$INCOMINGNUMBER$"
|
||||
[ -z "$INCOMINGNUMBER" ] && exit 1
|
||||
[ ! -f "$BLOCKFILE" ] && exit 1
|
||||
|
||||
norm_phone() {
|
||||
printf '%s' "$1" | tr -cd '0-9+*#'
|
||||
}
|
||||
|
||||
suffix_key() {
|
||||
digits="$(printf '%s' "$1" | tr -cd '0-9')"
|
||||
len="${#digits}"
|
||||
if [ "$len" -ge 9 ]; then
|
||||
printf '%s' "$digits" | tail -c 9
|
||||
else
|
||||
printf '%s' "$digits"
|
||||
fi
|
||||
}
|
||||
|
||||
IN_NORM="$(norm_phone "$INCOMINGNUMBER")"
|
||||
[ -z "$IN_NORM" ] && exit 1
|
||||
IN_SFX="$(suffix_key "$IN_NORM")"
|
||||
|
||||
while IFS="$(printf '\t')" read -r pat _rest || [ -n "$pat" ]; do
|
||||
[ -z "$pat" ] && continue
|
||||
PAT_NORM="$(norm_phone "$pat")"
|
||||
[ -z "$PAT_NORM" ] && continue
|
||||
|
||||
if [ "$PAT_NORM" = "$IN_NORM" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$PAT_NORM" in
|
||||
*\*)
|
||||
PREFIX="${PAT_NORM%\*}"
|
||||
if [ -n "$PREFIX" ]; then
|
||||
case "$IN_NORM" in
|
||||
"$PREFIX"*) exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
PAT_SFX="$(suffix_key "$PAT_NORM")"
|
||||
if [ "${#IN_SFX}" -ge 7 ] && [ "$PAT_SFX" = "$IN_SFX" ]; then
|
||||
exit 0
|
||||
fi
|
||||
done < "$BLOCKFILE"
|
||||
|
||||
exit 1
|
||||
|
||||
@@ -33,3 +33,4 @@ write_line_app() {
|
||||
|
||||
write_line_app snake "$icon_gam Snake" "snake"
|
||||
write_line_app tetris "$icon_gam Tetris" "tetris"
|
||||
write_line_app gambatte "$icon_gam Game Boy (Gambatte)" "gambatte"
|
||||
|
||||
Reference in New Issue
Block a user