I completely agree, that this is mailbox dependend.
It is not possible with some databases to determine the amount of storage per user
Eventually I think it should be linked to the UserRepository and the Mailbox. The more I think about it we can just calculate the present message size and store it in the mailbox. We don't need to rely on underlying support. We should support both "safe" and "fast" quotas. Safe quotas are done as a (potentially slow) calculation (select sum(size) from entitymailbox where user=X) and fast quotas maintain a lookup table. The reason one is safe and one is fast is that the lookup table could easily get out of synch.