When calculating the quota of a maildir, courier-imap & sqwebmail ignore any mail that has been trashed. While this meets the design of maildir++, it is, in my opinion, a bug in the specification, as users can keep more mail than their quota allows by trashing it without expunging.
The following patch disables this behaviour.
The patch: is here Current version is courier-imap-1.4.6-trashquota-20020909.patch. It is to be patched against courier-imap 1.4.6
For sqwebmail, the patch: is here Current version is sqwebmail-3.3.7-trashquota-20020909.patch. It is to be patched against sqwebmail 3.3.7