| 186 | class readonly(abort): pass # Mailbox status changed to READ-ONLY |
| 187 | |
| 188 | def __init__(self, host='', port=IMAP4_PORT, timeout=None): |
| 189 | self.debug = Debug |
| 190 | self.state = 'LOGOUT' |
| 191 | self.literal = None # A literal argument to a command |
| 192 | self.tagged_commands = {} # Tagged commands awaiting response |
| 193 | self.untagged_responses = {} # {typ: [data, ...], ...} |
| 194 | self.continuation_response = '' # Last continuation response |
| 195 | self.is_readonly = False # READ-ONLY desired state |
| 196 | self.tagnum = 0 |
| 197 | self._tls_established = False |
| 198 | self._mode_ascii() |
| 199 | |
| 200 | # Open socket to server. |
| 201 | |
| 202 | self.open(host, port, timeout) |
| 203 | |
| 204 | try: |
| 205 | self._connect() |
| 206 | except Exception: |
| 207 | try: |
| 208 | self.shutdown() |
| 209 | except OSError: |
| 210 | pass |
| 211 | raise |
| 212 | |
| 213 | def _mode_ascii(self): |
| 214 | self.utf8_enabled = False |