diff --git a/chatmaild/src/chatmaild/ini/chatmail.ini.f b/chatmaild/src/chatmaild/ini/chatmail.ini.f index 16f2477..0a28bb1 100644 --- a/chatmaild/src/chatmaild/ini/chatmail.ini.f +++ b/chatmaild/src/chatmaild/ini/chatmail.ini.f @@ -17,8 +17,8 @@ max_user_send_per_minute = 60 # maximum mailbox size of a chatmail account max_mailbox_size = 100M -# time after which mails are unconditionally deleted -delete_mails_after = 40d +# days after which mails are unconditionally deleted +delete_mails_after = 40 # minimum length a username must have username_min_length = 9 diff --git a/cmdeploy/src/cmdeploy/dovecot/expunge.cron.j2 b/cmdeploy/src/cmdeploy/dovecot/expunge.cron.j2 index 0abc950..cb8ea7c 100644 --- a/cmdeploy/src/cmdeploy/dovecot/expunge.cron.j2 +++ b/cmdeploy/src/cmdeploy/dovecot/expunge.cron.j2 @@ -1,4 +1,10 @@ -2 0 * * * dovecot doveadm expunge -A SAVEDBEFORE {{ config.delete_mails_after }} MAILBOX INBOX -2 0 * * * dovecot doveadm expunge -A SAVEDBEFORE {{ config.delete_mails_after }} MAILBOX Deltachat -2 0 * * * dovecot doveadm expunge -A SAVEDBEFORE {{ config.delete_mails_after }} MAILBOX Trash -2 30 * * * dovecot doveadm purge -A +# delete all mails after {{ config.delete_mails_after }} days, in the Inbox +2 0 * * * dovecot find /home/vmail/mail/{{ config.mail_domain }}/*/cur -depth -mtime +{{ config.delete_mails_after }} -type f -delete +# or in any IMAP subfolder +2 0 * * * dovecot find /home/vmail/mail/{{ config.mail_domain }}/*/.*/cur -depth -mtime +{{ config.delete_mails_after }} -type f -delete +# even if they are unseen +2 0 * * * dovecot find /home/vmail/mail/{{ config.mail_domain }}/*/new -depth -mtime +{{ config.delete_mails_after }} -type f -delete +2 0 * * * dovecot find /home/vmail/mail/{{ config.mail_domain }}/*/.*/new -depth -mtime +{{ config.delete_mails_after }} -type f -delete +# or only temporary (but then they shouldn't be around after {{ config.delete_mails_after }} days anyway). +2 0 * * * dovecot find /home/vmail/mail/{{ config.mail_domain }}/*/tmp -depth -mtime +{{ config.delete_mails_after }} -type f -delete +2 0 * * * dovecot find /home/vmail/mail/{{ config.mail_domain }}/*/.*/tmp -depth -mtime +{{ config.delete_mails_after }} -type f -delete diff --git a/cmdeploy/src/cmdeploy/www.py b/cmdeploy/src/cmdeploy/www.py index b7b2c2a..2a92133 100644 --- a/cmdeploy/src/cmdeploy/www.py +++ b/cmdeploy/src/cmdeploy/www.py @@ -36,29 +36,6 @@ def build_webpages(src_dir, build_dir, config): print(traceback.format_exc()) -def timespan_to_english(timespan): - val = int(timespan[:-1]) - c = timespan[-1].lower() - match c: - case "y": - return f"{val} years" - case "m": - return f"{val} months" - case "w": - return f"{val} weeks" - case "d": - return f"{val} days" - case "h": - return f"{val} hours" - case "c": - return f"{val} seconds" - case _: - raise ValueError( - c - + " is not a valid time unit. Try [y]ears, [w]eeks, [d]ays, or [h]ours" - ) - - def int_to_english(number): if number >= 0 and number <= 12: a = [ @@ -104,9 +81,6 @@ def _build_webpages(src_dir, build_dir, config): render_vars["password_min_length"] = int_to_english( config.password_min_length ) - render_vars["delete_mails_after"] = timespan_to_english( - config.delete_mails_after - ) target = build_dir.joinpath(path.stem + ".html") # recursive jinja2 rendering diff --git a/www/src/info.md b/www/src/info.md index cab0747..e5bb76e 100644 --- a/www/src/info.md +++ b/www/src/info.md @@ -42,7 +42,7 @@ The first login sets your password. - You may send up to {{ config.max_user_send_per_minute }} messages per minute. -- Messages are unconditionally removed {{ delete_mails_after }} after arriving on the server +- Messages are unconditionally removed {{ config.delete_mails_after }} days after arriving on the server - You can store up to [{{ config.max_mailbox_size }} messages on the server](https://delta.chat/en/help#what-happens-if-i-turn-on-delete-old-messages-from-server).