|
| 1 | + |
1 | 2 | """IMAP4 client. |
2 | 3 |
|
3 | 4 | Based on RFC 2060. |
|
13 | 14 | ParseFlags |
14 | 15 | Time2Internaldate |
15 | 16 | """ |
16 | | -# |
17 | | -# $Header$ |
18 | | -# |
19 | | -__version__ = "$Revision$" |
| 17 | + |
| 18 | +__version__ = "2.11" |
20 | 19 |
|
21 | 20 | import binascii, re, socket, string, time, random |
22 | 21 |
|
@@ -87,10 +86,10 @@ class IMAP4: |
87 | 86 | name (in lower-case). |
88 | 87 |
|
89 | 88 | All arguments to commands are converted to strings, except for |
90 | | - the last argument to APPEND which is passed as an IMAP4 |
91 | | - literal. If necessary (the string contains white-space and |
92 | | - isn't enclosed with either parentheses or double quotes) each |
93 | | - string is quoted. |
| 89 | + AUTHENTICATE, and the last argument to APPEND which is passed as |
| 90 | + an IMAP4 literal. If necessary (the string contains |
| 91 | + white-space and isn't enclosed with either parentheses or |
| 92 | + double quotes) each string is quoted. |
94 | 93 |
|
95 | 94 | Each command returns a tuple: (type, [data, ...]) where 'type' |
96 | 95 | is usually 'OK' or 'NO', and 'data' is either the text from the |
@@ -157,14 +156,13 @@ def __init__(self, host = '', port = IMAP4_PORT): |
157 | 156 | if __debug__ and self.debug >= 3: |
158 | 157 | print '\tCAPABILITIES: %s' % `self.capabilities` |
159 | 158 |
|
160 | | - self.PROTOCOL_VERSION = None |
161 | 159 | for version in AllowedVersions: |
162 | 160 | if not version in self.capabilities: |
163 | 161 | continue |
164 | 162 | self.PROTOCOL_VERSION = version |
165 | | - break |
166 | | - if not self.PROTOCOL_VERSION: |
167 | | - raise self.error('server not IMAP4 compliant') |
| 163 | + return |
| 164 | + |
| 165 | + raise self.error('server not IMAP4 compliant') |
168 | 166 |
|
169 | 167 |
|
170 | 168 | def open(self, host, port): |
@@ -915,15 +913,13 @@ def _trunc(m, s): |
915 | 913 |
|
916 | 914 | if __debug__ and __name__ == '__main__': |
917 | 915 |
|
| 916 | + import getpass, sys |
| 917 | + |
918 | 918 | host = '' |
919 | | - import sys |
920 | | - if sys.argv[1:]: |
921 | | - host = sys.argv[1] |
| 919 | + if sys.argv[1:]: host = sys.argv[1] |
922 | 920 |
|
923 | | - import getpass |
924 | 921 | USER = getpass.getuser() |
925 | | - PASSWD = getpass.getpass( |
926 | | - "IMAP password for %s: " % (host or "localhost")) |
| 922 | + PASSWD = getpass.getpass("IMAP password for %s: " % (host or "localhost")) |
927 | 923 |
|
928 | 924 | test_seq1 = ( |
929 | 925 | ('login', (USER, PASSWD)), |
|
0 commit comments