diff --git a/management/mailconfig.py b/management/mailconfig.py index 73b166a1..cdd05079 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -132,10 +132,27 @@ def get_mail_users_ex(env, with_archived=False): for email, privileges, quota in c.fetchall(): active_accounts.add(email) + (user, domain) = email.split('@') + box_size = 0 + box_count = 0 + box_quota = '' + try: + with open('/home/user-data/mail/mailboxes/%s/%s/maildirsize' % (domain, user), 'r') as f: + box_quota = f.readline() + for line in f.readlines(): + (size, count) = line.split(' ') + box_size += int(size) + box_count += int(count) + except: + box_size = '?' + user = { "email": email, "privileges": parse_privs(privileges), "quota": quota, + "box_quota": box_quota, + "box_size": '%iK' % int(box_size / 1024), + "box_count": box_count, "status": "active", } users.append(user) diff --git a/management/templates/users.html b/management/templates/users.html index 40f3be08..0175b929 100644 --- a/management/templates/users.html +++ b/management/templates/users.html @@ -42,6 +42,7 @@ Email Address + Box Size Quota Actions @@ -55,6 +56,7 @@ + @@ -161,6 +163,7 @@ function show_users() { n.attr('data-email', user.email); n.attr('data-quota', user.quota); n.find('.address').text(user.email); + n.find('.box-size').text(user.box_size); n.find('.quota').text((user.quota == '0') ? 'unlimited' : user.quota); n2.find('.restore_info tt').text(user.mailbox);