Hello everyone,
I'm experimenting with the quota warning plugin. I have the following setting in Dovecot's general config:
plugin { quota_warning = storage=75%% /var/www/contrib/doquotawarning.py 75 quota_warning2 = storage=90%% /var/www/contrib/doquotawarning.py 90 }
The doquotawarning.py script is working okay -- meaning that the user gets a warning. My SQL backend uses the following query:
user_query =
SELECT m.maildir AS home, 1001 AS uid, 1001 AS gid,
CONCAT('*:bytes=', m.quota, 'M') AS quota_rule,
'Trash:ignore' AS quota_rule2
FROM mailbox m
INNER JOIN domain d
ON d.id = m.domainid
WHERE d.domain = '%d'
AND m.user = '%n'
Where m.quota is the user's personal quota (in MB). As you can see, we ignore the 'Trash' box, when considering the usage data. We are using the dict quota backend.
Now this is what happens. Assume we have 'user@example.org', that has a quota of 10MB and he currently has 5MB in use. Now someone sends a 3MB email towards 'user@example.org'. Dovecot does indeed generate the warning message (75%), that arrives correctly 'together' with the 3MB email.
Now the user moves the 3MB email to trash. This goes well, however: Dovecot generates the 75% warning message again. Which is not necessary: the user was cleaning his mailbox, i.e. usage is 5MB again.
I have the feeling Dovecot is generating the warning event twice. When getting from e.g. 50% to 79% and when the usage is lowered from 87% to 70%. I have the feeling this is either not the correct behavior, or I'm misinformed. When looking at the source, this shouldn't be happening:
if ((bytes_before < (uint64_t)warnings[i].rule.bytes_limit && bytes_current >= (uint64_t)warnings[i].rule.bytes_limit) || (count_before < (uint64_t)warnings[i].rule.count_limit && count_current >= (uint64_t)warnings[i].rule.count_limit)) { quota_warning_execute(root, warnings[i].command); break; }
We're using Dovecot 1.2.9 (Ubuntu's 10.04 LTS version).
-- Kind regards, Harm van Tilborg