mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
Apply suggestions from code review
Co-authored-by: link2xt <link2xt@testrun.org>
This commit is contained in:
@@ -13,7 +13,7 @@ def read_config(inipath, mail_basedir=None):
|
||||
|
||||
|
||||
class Config:
|
||||
def __init__(self, inipath, params, mail_basedir):
|
||||
def __init__(self, inipath, params, mail_basedir: Path):
|
||||
self._inipath = inipath
|
||||
self.mail_domain = params["mail_domain"]
|
||||
self.max_user_send_per_minute = int(params["max_user_send_per_minute"])
|
||||
|
||||
@@ -124,7 +124,7 @@ def lookup_passdb(db, config: Config, user, cleartext_password, last_login=None)
|
||||
q = """INSERT INTO users (addr, password, last_login)
|
||||
VALUES (?, ?, ?)"""
|
||||
conn.execute(q, (user, encrypted_password, last_login))
|
||||
print(f"Created e-mail address: {user}", file=sys.stderr)
|
||||
print(f"Created address: {user}", file=sys.stderr)
|
||||
return dict(
|
||||
home=f"/home/vmail/mail/{config.mail_domain}/{user}",
|
||||
uid="vmail",
|
||||
@@ -146,7 +146,7 @@ def iter_userdb_lastlogin_before(db, cutoff_date):
|
||||
"""Get a list of users where last login was before cutoff_date."""
|
||||
with db.read_connection() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT addr FROM users WHERE last_login <?", (cutoff_date,)
|
||||
"SELECT addr FROM users WHERE last_login < ?", (cutoff_date,)
|
||||
).fetchall()
|
||||
return [x[0] for x in rows]
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
||||
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/.*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
||||
3 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -name 'maildirsize' -type f -delete
|
||||
4 0 * * * vmail /usr/local/lib/chatmaild/venv/bin/delete_inactive_users /home/vmail/passdb.lite /usr/local/lib/chatmaild/chatmail.ini
|
||||
4 0 * * * vmail /usr/local/lib/chatmaild/venv/bin/delete_inactive_users /home/vmail/passdb.sqlite /usr/local/lib/chatmaild/chatmail.ini
|
||||
|
||||
Reference in New Issue
Block a user