Commit b1f0812b authored by Guido van Rossum's avatar Guido van Rossum

Piers' latest version, labeled 2.11. This time he integrated my

changes, and made only a few minor changes.  No changes of my own this
time.
parent 95e6f708
"""IMAP4 client. """IMAP4 client.
Based on RFC 2060. Based on RFC 2060.
...@@ -13,10 +14,8 @@ Public functions: Internaldate2tuple ...@@ -13,10 +14,8 @@ Public functions: Internaldate2tuple
ParseFlags ParseFlags
Time2Internaldate Time2Internaldate
""" """
#
# $Header$ __version__ = "2.11"
#
__version__ = "$Revision$"
import binascii, re, socket, string, time, random import binascii, re, socket, string, time, random
...@@ -87,10 +86,10 @@ class IMAP4: ...@@ -87,10 +86,10 @@ class IMAP4:
name (in lower-case). name (in lower-case).
All arguments to commands are converted to strings, except for All arguments to commands are converted to strings, except for
the last argument to APPEND which is passed as an IMAP4 AUTHENTICATE, and the last argument to APPEND which is passed as
literal. If necessary (the string contains white-space and an IMAP4 literal. If necessary (the string contains
isn't enclosed with either parentheses or double quotes) each white-space and isn't enclosed with either parentheses or
string is quoted. double quotes) each string is quoted.
Each command returns a tuple: (type, [data, ...]) where 'type' Each command returns a tuple: (type, [data, ...]) where 'type'
is usually 'OK' or 'NO', and 'data' is either the text from the is usually 'OK' or 'NO', and 'data' is either the text from the
...@@ -157,14 +156,13 @@ class IMAP4: ...@@ -157,14 +156,13 @@ class IMAP4:
if __debug__ and self.debug >= 3: if __debug__ and self.debug >= 3:
print '\tCAPABILITIES: %s' % `self.capabilities` print '\tCAPABILITIES: %s' % `self.capabilities`
self.PROTOCOL_VERSION = None
for version in AllowedVersions: for version in AllowedVersions:
if not version in self.capabilities: if not version in self.capabilities:
continue continue
self.PROTOCOL_VERSION = version self.PROTOCOL_VERSION = version
break return
if not self.PROTOCOL_VERSION:
raise self.error('server not IMAP4 compliant') raise self.error('server not IMAP4 compliant')
def open(self, host, port): def open(self, host, port):
...@@ -915,15 +913,13 @@ if __debug__: ...@@ -915,15 +913,13 @@ if __debug__:
if __debug__ and __name__ == '__main__': if __debug__ and __name__ == '__main__':
import getpass, sys
host = '' host = ''
import sys if sys.argv[1:]: host = sys.argv[1]
if sys.argv[1:]:
host = sys.argv[1]
import getpass
USER = getpass.getuser() USER = getpass.getuser()
PASSWD = getpass.getpass( PASSWD = getpass.getpass("IMAP password for %s: " % (host or "localhost"))
"IMAP password for %s: " % (host or "localhost"))
test_seq1 = ( test_seq1 = (
('login', (USER, PASSWD)), ('login', (USER, PASSWD)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment