]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF patch #433619, by Michel Pelletier:
authorGuido van Rossum <guido@python.org>
Sun, 17 Jun 2001 13:31:25 +0000 (13:31 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 17 Jun 2001 13:31:25 +0000 (13:31 +0000)
Summary: NAMESPACE support in imaplib.py

Initial Comment:
Support for the IMAP NAMESPACE extension defined in rfc
2342.  This is almost a necessity for working with
modern IMAP servers.

Lib/imaplib.py

index 2a0eeb6ff46448050633bc942e91ae622b9f1819..4706eea02d4689e0196fd02b94570ab1796e3425 100644 (file)
@@ -58,6 +58,7 @@ Commands = {
         'SUBSCRIBE':    ('AUTH', 'SELECTED'),
         'UID':          ('SELECTED',),
         'UNSUBSCRIBE':  ('AUTH', 'SELECTED'),
+        'NAMESPACE':    ('AUTH', 'SELECTED'),
         }
 
 #       Patterns to match server responses
@@ -571,6 +572,12 @@ class IMAP4:
             raise self.error('unknown extension command: %s' % name)
         return apply(self._simple_command, (name,) + args)
 
+    def namespace(self):
+       """ Returns IMAP namespaces ala rfc2342
+       """
+       name = 'NAMESPACE'
+       typ, dat = self._simple_command(name)
+       return self._untagged_response(typ, dat, name)
 
 
     #       Private methods