From 68c5fa5b86dc6c9ec478577c4ce41d087d74b0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Tue, 7 Jan 2025 12:44:03 +0100 Subject: [PATCH] manage period for sender and receiver --- src/bash/filter.sh | 22 ++++++++++++++++++++-- src/bash/filterTest.sh | 2 +- src/cpp/eMailShrinker.cpp | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) mode change 100755 => 100644 src/bash/filter.sh diff --git a/src/bash/filter.sh b/src/bash/filter.sh old mode 100755 new mode 100644 index 92ed77d..58eacdb --- a/src/bash/filter.sh +++ b/src/bash/filter.sh @@ -33,7 +33,7 @@ # knowledge of the CeCILL-B license and that you accept its terms. # ########################################################################## # Kaz addon (see https://git.kaz.bzh/KAZ/depollueur for information) -# version : 2.22 (2024-12-09) +# version : 2.23 (2025-01-07) ########################################################################## # - installer l'utilitaire apg pour génération de mot de passes @@ -163,6 +163,24 @@ function check_skip_domains() { echo "no" } +# choisir la période max +function check_max_period() { + local LIST_EMAILS="$1" + LPERIOD="" + + for email in ${LIST_EMAILS}; do + LPERIOD="${LPERIOD} $(curl "${JIRAFEAU_LOCAL}/a.php?p=${email}" 2>/dev/null)" + done + + for p in semester quarter month week day hour minute; do + if [[ "${LPERIOD}" =~ (^|[[:space:]])$p($|[[:space:]]) ]]; then + echo "${p}" + return + fi + done + echo "${DEFAULT_PERIOD}" +} + #################### MAIN ################################################# echo -e "${NL}${BLUE}$(date +%d-%m-%Y-%H-%M-%S)${NC} : ${GREEN}######################################## filter start (log in ${TMP_LOG})${NC}" >> "${FIC_LOG}" LOG_FIC "${GREEN}######################################## ${TMP_LOG} ${NC}" @@ -187,7 +205,7 @@ MODE=$(curl "${JIRAFEAU_LOCAL}/a.php?m=${MAIL_SOURCE}" 2>/dev/null ) [[ "${MODE}" =~ ^(none|footer|attachment|both)$ ]] || MODE="${DEFAULT_MODE}" TRACK=$(curl "${JIRAFEAU_LOCAL}/a.php?r=${MAIL_SOURCE}" 2>/dev/null ) [[ "${TRACK}" =~ ^(|0|1|false|true|FALSE|TRUE|on|off)$ ]] || TRACK="${DEFAULT_TRACK}" -PERIOD=$(curl "${JIRAFEAU_LOCAL}/a.php?p=${MAIL_SOURCE}" 2>/dev/null ) +PERIOD=$(check_max_period "${LIST_EMAILS}") [[ "${PERIOD}" =~ ^(minute|hour|day|week|month|quarter|semester)$ ]] || PERIOD="${DEFAULT_PERIOD}" LOG_FIC "${NL}" \ diff --git a/src/bash/filterTest.sh b/src/bash/filterTest.sh index 1d91215..242bf3f 100755 --- a/src/bash/filterTest.sh +++ b/src/bash/filterTest.sh @@ -33,7 +33,7 @@ # knowledge of the CeCILL-B license and that you accept its terms. # ########################################################################## # Kaz addon (see https://git.kaz.bzh/KAZ/depollueur for information) -# version : 2.22 (2024-12-09) +# version : 2.23 (2025-01-07) PRG=$(basename $0) diff --git a/src/cpp/eMailShrinker.cpp b/src/cpp/eMailShrinker.cpp index 3a3f198..7617881 100644 --- a/src/cpp/eMailShrinker.cpp +++ b/src/cpp/eMailShrinker.cpp @@ -33,8 +33,8 @@ //////////////////////////////////////////////////////////////////////////// #include "version.hpp" -const std::string kaz::LAST_VERSION_NUM ("2.22"); -const std::string kaz::LAST_VERSION_DATE ("2024-12-09"); +const std::string kaz::LAST_VERSION_NUM ("2.23"); +const std::string kaz::LAST_VERSION_DATE ("2025-01-07"); const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker"); #include