@Override
protected void doProcess(GetQuotaRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) {
try {
QuotaRoot quotaRoot = quotaRootResolver.fromString(message.getQuotaRoot());
if (hasRight(quotaRoot, session)) {
Quota<QuotaCount> messageQuota = quotaManager.getMessageQuota(quotaRoot);
Quota<QuotaSize> storageQuota = quotaManager.getStorageQuota(quotaRoot);
if (messageQuota.getLimit().isLimited()) {
responder.respond(new QuotaResponse(ImapConstants.MESSAGE_QUOTA_RESOURCE, quotaRoot.getValue(), messageQuota));
}
if (storageQuota.getLimit().isLimited()) {
responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
}
okComplete(command, tag, responder);
} else {
Object[] params = new Object[]{
MailboxACL.Right.Read.toString(),
command.getName(),
"Any mailbox of this user USER"
};
HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
no(command, tag, responder, humanReadableText);
}
} catch (MailboxException me) {
taggedBad(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
}
}