From 64de63815d87cba788e4430e6f9328d2b2b30eef Mon Sep 17 00:00:00 2001 From: Christian Hagenest Date: Wed, 26 Jun 2024 16:05:51 +0200 Subject: [PATCH] ruff again :) --- chatmaild/src/chatmaild/doveauth.py | 3 ++- chatmaild/src/chatmaild/rm_accounts.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/chatmaild/src/chatmaild/doveauth.py b/chatmaild/src/chatmaild/doveauth.py index 70b6215e..bebd7629 100644 --- a/chatmaild/src/chatmaild/doveauth.py +++ b/chatmaild/src/chatmaild/doveauth.py @@ -106,7 +106,8 @@ def lookup_passdb(db, config: Config, user, cleartext_password): if userdata: # Update last login time. conn.execute( - "UPDATE users SET last_login=? WHERE addr=?", (round(int(time.time()) // 86400), user) + "UPDATE users SET last_login=? WHERE addr=?", + (round(int(time.time()) // 86400), user), ) userdata["home"] = f"/home/vmail/mail/{config.mail_domain}/{user}" diff --git a/chatmaild/src/chatmaild/rm_accounts.py b/chatmaild/src/chatmaild/rm_accounts.py index 3c5bbcf9..7534f3c0 100644 --- a/chatmaild/src/chatmaild/rm_accounts.py +++ b/chatmaild/src/chatmaild/rm_accounts.py @@ -15,7 +15,7 @@ from socketserver import ( from .config import Config, read_config from .database import Database - + def remove_users(db: Database, cutoff_date: int): db.connect() try: @@ -25,6 +25,7 @@ def remove_users(db: Database, cutoff_date: int): finally: db.close() + def remove_user_data(db: Database, cutoff_date: int, dir: Path): """Collects all users where last_login < cutoff_date and deletes corresponding directories.""" db.connect() @@ -33,13 +34,13 @@ def remove_user_data(db: Database, cutoff_date: int, dir: Path): select_query = "SELECT user FROM users WHERE last_login