From c456fe12b3117033bc22bf5c6039f3006f2728c7 Mon Sep 17 00:00:00 2001 From: andryyy Date: Tue, 29 Jan 2019 12:13:26 +0100 Subject: [PATCH] [Dovecot] Fix last_notification in quarantine_notify.py --- data/Dockerfiles/dovecot/quarantine_notify.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/data/Dockerfiles/dovecot/quarantine_notify.py b/data/Dockerfiles/dovecot/quarantine_notify.py index fd5a8072..6d3504d1 100755 --- a/data/Dockerfiles/dovecot/quarantine_notify.py +++ b/data/Dockerfiles/dovecot/quarantine_notify.py @@ -98,13 +98,16 @@ for record in records: attrs_json = query_mysql('SELECT attributes FROM mailbox WHERE username = "%s"' % (record['rcpt'])) attrs = json.loads(str(attrs_json[0]['attributes'])) if attrs['quarantine_notification'] == 'hourly': - if last_notification == 0 or (last_notification + 3600) > time_now: + if last_notification == 0 or (last_notification + 3600) < time_now: + print "Notifying %s about %d new items in quarantine" % (record['rcpt'], record['counter']) notify_rcpt(record['rcpt'], record['counter']) elif attrs['quarantine_notification'] == 'daily': - if last_notification == 0 or (last_notification + 86400) > time_now: + if last_notification == 0 or (last_notification + 86400) < time_now: + print "Notifying %s about %d new items in quarantine" % (record['rcpt'], record['counter']) notify_rcpt(record['rcpt'], record['counter']) elif attrs['quarantine_notification'] == 'weekly': - if last_notification == 0 or (last_notification + 604800) > time_now: + if last_notification == 0 or (last_notification + 604800) < time_now: + print "Notifying %s about %d new items in quarantine" % (record['rcpt'], record['counter']) notify_rcpt(record['rcpt'], record['counter']) else: break