[Python-checkins] python/dist/src/Lib imaplib.py,1.49,1.50
pierslauder@users.sourceforge.net
pierslauder@users.sourceforge.net
Mon, 17 Jun 2002 00:07:23 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13513/dist/src/Lib
Modified Files:
imaplib.py
Log Message:
Add IMAP4 QUOTA extension methods
Index: imaplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** imaplib.py 5 Jun 2002 22:31:57 -0000 1.49
--- imaplib.py 17 Jun 2002 07:07:20 -0000 1.50
***************
*** 17,22 ****
# GET/SETACL contributed by Anthony Baxter <anthony@interlink.com.au> April 2001.
# IMAP4_SSL contributed by Tino Lange <Tino.Lange@isg.de> March 2002.
! __version__ = "2.51"
import binascii, re, socket, time, random, sys
--- 17,23 ----
# GET/SETACL contributed by Anthony Baxter <anthony@interlink.com.au> April 2001.
# IMAP4_SSL contributed by Tino Lange <Tino.Lange@isg.de> March 2002.
+ # GET/SETQUOTA contributed by Andreas Zeidler <az@kreativkombinat.de> June 2002.
! __version__ = "2.52"
import binascii, re, socket, time, random, sys
***************
*** 49,52 ****
--- 50,55 ----
'FETCH': ('SELECTED',),
'GETACL': ('AUTH', 'SELECTED'),
+ 'GETQUOTA': ('AUTH', 'SELECTED'),
+ 'GETQUOTAROOT': ('AUTH', 'SELECTED'),
'LIST': ('AUTH', 'SELECTED'),
'LOGIN': ('NONAUTH',),
***************
*** 60,63 ****
--- 63,67 ----
'SELECT': ('AUTH', 'SELECTED'),
'SETACL': ('AUTH', 'SELECTED'),
+ 'SETQUOTA': ('AUTH', 'SELECTED'),
'SORT': ('SELECTED',),
'STATUS': ('AUTH', 'SELECTED'),
***************
*** 417,420 ****
--- 421,446 ----
+ def getquota(self, root):
+ """Get the quota root's resource usage and limits.
+
+ Part of the IMAP4 QUOTA extension defined in rfc2087.
+
+ (typ, [data]) = <instance>.getquota(root)
+ """
+ typ, dat = self._simple_command('GETQUOTA', root)
+ return self._untagged_response(typ, dat, 'QUOTA')
+
+
+ def getquotaroot(self, mailbox):
+ """Get the list of quota roots for the named mailbox.
+
+ (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
+ """
+ typ, dat = self._simple_command('GETQUOTA', root)
+ typ, quota = self._untagged_response(typ, dat, 'QUOTA')
+ typ, quotaroot = self._untagged_response(typ, dat, 'QUOTAROOT')
+ return typ, [quotaroot, quota]
+
+
def list(self, directory='""', pattern='*'):
"""List mailbox names in directory matching pattern.
***************
*** 567,570 ****
--- 593,605 ----
+ def setquota(self, root, limits):
+ """Set the quota root's resource limits.
+
+ (typ, [data]) = <instance>.setquota(root, limits)
+ """
+ typ, dat = self._simple_command('SETQUOTA', root, limits)
+ return self._untagged_response(typ, dat, 'QUOTA')
+
+
def sort(self, sort_criteria, charset, *search_criteria):
"""IMAP4rev1 extension SORT command.
***************
*** 1187,1191 ****
elif isinstance(date_time, (tuple, time.struct_time)):
tt = date_time
! elif isinstance(date_time, str):
return date_time # Assume in correct format
else:
--- 1222,1226 ----
elif isinstance(date_time, (tuple, time.struct_time)):
tt = date_time
! elif isinstance(date_time, str) and (date_time[0],date_time[-1]) == ('"','"'):
return date_time # Assume in correct format
else: