added IMAP, LetsEncrypt, update layout
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package mailstore
|
||||
|
||||
import "fmt"
|
||||
|
||||
// QuotaStatus reports a mailbox's storage usage — feeds the "≥90% full" badge on the
|
||||
// mailboxes list and the dashboard tile in a later milestone.
|
||||
func (s *Store) QuotaStatus(mailboxID int64) (used, quota int64, pctFull float64, err error) {
|
||||
mbox, err := s.DB.GetMailboxByID(mailboxID)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
}
|
||||
if mbox == nil {
|
||||
return 0, 0, 0, fmt.Errorf("mailstore: mailbox %d not found", mailboxID)
|
||||
}
|
||||
if mbox.QuotaBytes == 0 {
|
||||
return mbox.UsedBytes, 0, 0, nil
|
||||
}
|
||||
return mbox.UsedBytes, mbox.QuotaBytes, float64(mbox.UsedBytes) / float64(mbox.QuotaBytes) * 100, nil
|
||||
}
|
||||
Reference in New Issue
Block a user