summaryrefslogtreecommitdiffstats
path: root/cyruslib.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-13 11:35:06 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-13 11:35:06 +0100
commitd310f8a8ba453cc1030a6a83cbdd8332a5fb64ff (patch)
tree5e8e4795f229e9701450129cb38ccd36f93a5948 /cyruslib.py
parent5c1c4c70bae2be6e50063434e8ec69ef89bd4983 (diff)
downloadpykolab-d310f8a8ba453cc1030a6a83cbdd8332a5fb64ff.tar.gz
Add QUOTAROOT command lqr
Diffstat (limited to 'cyruslib.py')
-rw-r--r--cyruslib.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/cyruslib.py b/cyruslib.py
index 7df43a0..20dd55b 100644
--- a/cyruslib.py
+++ b/cyruslib.py
@@ -586,6 +586,27 @@ class CYRUS:
self.__verbose( '[GETQUOTA %s] BAD: Error while parsing results' % mailbox )
return 0, 0
+ def lqr(self, mailbox):
+ """List Quota Root"""
+ self.__prepare('GETQUOTAROOT', mailbox)
+ res, msg = self.__docommand("getquotaroot", self.decode(mailbox))
+ (_mailbox, _root) = msg[0][0].split()
+
+ match = re_q0.match(msg[1][0])
+ if match:
+ self.__verbose( '[GETQUOTAROOT %s] QUOTAROOT (Unlimited)' % mailbox )
+ return _root, 0, 0
+
+ match = re_q.match(msg[1][0])
+ try:
+ used = int(match.group(2))
+ quota = int(match.group(3))
+ self.__verbose( '[GETQUOTAROOT %s] %s: QUOTA (%d/%d)' % (mailbox, res, used, quota) )
+ return _root, used, quota
+ except:
+ self.__verbose( '[GETQUOTAROOT %s] BAD: Error while parsing results' % mailbox )
+ return _root, 0, 0
+
def sq(self, mailbox, limit):
"""Set Quota"""
self.__prepare('SETQUOTA', mailbox)