Hi all
I managed to handle the disk quotas (even if not in the matcher...).
I have one doubt about the correctness of the
AbstractStorageQuota.getUsed().
It checks if all the EXISTING mails in the mailbox don't exceed the quota.
If the incoming mail is big enough, the quota will be exceeded.
The FOLLOWING mail will be rejected (or whatever james is configured to do).
Wouldn't be more correct to extend the check to the "work in progress" mail
too?
I mean, in AbstractStorageQuota:
protected long getUsed(MailAddress recipient, Mail currentMail) throws
MessagingException {
long size = 0;
MailRepository userInbox =
mailServer.getUserInbox(getPrimaryName(recipient.getUser()));
for (Iterator it = userInbox.list(); it.hasNext(); ) {
String key = (String) it.next();
MailImpl mc = userInbox.retrieve(key);
// Retrieve can return null if the mail is no longer in the
store.
if (mc != null) try {
size += mc.getMessageSize();
} catch (Throwable e) {
// MailRepository.retrieve() does NOT lock the message.
// It could be deleted while we're looping.
log("Exception in getting message size: " + e.getMessage());
}
}
MailImpl currentMailImpl = new
MailImpl(currentMail.getMimeMessage());
size+=currentMailImpl.getMessageSize();
return size;
}
Ciao
Marcello
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]