manage period for sender and receiver

This commit is contained in:
François 2025-01-07 12:44:03 +01:00
parent 72496c641e
commit 68c5fa5b86
3 changed files with 23 additions and 5 deletions

22
src/bash/filter.sh Executable file → Normal file
View File

@ -33,7 +33,7 @@
# knowledge of the CeCILL-B license and that you accept its terms. # # knowledge of the CeCILL-B license and that you accept its terms. #
########################################################################## ##########################################################################
# Kaz addon (see https://git.kaz.bzh/KAZ/depollueur for information) # 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 # - installer l'utilitaire apg pour génération de mot de passes
@ -163,6 +163,24 @@ function check_skip_domains() {
echo "no" 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 ################################################# #################### MAIN #################################################
echo -e "${NL}${BLUE}$(date +%d-%m-%Y-%H-%M-%S)${NC} : ${GREEN}######################################## filter start (log in ${TMP_LOG})${NC}" >> "${FIC_LOG}" 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}" 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}" [[ "${MODE}" =~ ^(none|footer|attachment|both)$ ]] || MODE="${DEFAULT_MODE}"
TRACK=$(curl "${JIRAFEAU_LOCAL}/a.php?r=${MAIL_SOURCE}" 2>/dev/null ) TRACK=$(curl "${JIRAFEAU_LOCAL}/a.php?r=${MAIL_SOURCE}" 2>/dev/null )
[[ "${TRACK}" =~ ^(|0|1|false|true|FALSE|TRUE|on|off)$ ]] || TRACK="${DEFAULT_TRACK}" [[ "${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}" [[ "${PERIOD}" =~ ^(minute|hour|day|week|month|quarter|semester)$ ]] || PERIOD="${DEFAULT_PERIOD}"
LOG_FIC "${NL}" \ LOG_FIC "${NL}" \

View File

@ -33,7 +33,7 @@
# knowledge of the CeCILL-B license and that you accept its terms. # # knowledge of the CeCILL-B license and that you accept its terms. #
########################################################################## ##########################################################################
# Kaz addon (see https://git.kaz.bzh/KAZ/depollueur for information) # 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) PRG=$(basename $0)

View File

@ -33,8 +33,8 @@
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
#include "version.hpp" #include "version.hpp"
const std::string kaz::LAST_VERSION_NUM ("2.22"); const std::string kaz::LAST_VERSION_NUM ("2.23");
const std::string kaz::LAST_VERSION_DATE ("2024-12-09"); const std::string kaz::LAST_VERSION_DATE ("2025-01-07");
const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker"); const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker");
#include <iostream> #include <iostream>