| OLD | NEW |
| 1 """TLS Lite + imaplib.""" | 1 """TLS Lite + imaplib.""" |
| 2 | 2 |
| 3 import socket | 3 import socket |
| 4 from imaplib import IMAP4 | 4 from imaplib import IMAP4 |
| 5 from tlslite.TLSConnection import TLSConnection | 5 from tlslite.tlsconnection import TLSConnection |
| 6 from tlslite.integration.ClientHelper import ClientHelper | 6 from tlslite.integration.clienthelper import ClientHelper |
| 7 | 7 |
| 8 # IMAP TLS PORT | 8 # IMAP TLS PORT |
| 9 IMAP4_TLS_PORT = 993 | 9 IMAP4_TLS_PORT = 993 |
| 10 | 10 |
| 11 class IMAP4_TLS(IMAP4, ClientHelper): | 11 class IMAP4_TLS(IMAP4, ClientHelper): |
| 12 """This class extends L{imaplib.IMAP4} with TLS support.""" | 12 """This class extends L{imaplib.IMAP4} with TLS support.""" |
| 13 | 13 |
| 14 def __init__(self, host = '', port = IMAP4_TLS_PORT, | 14 def __init__(self, host = '', port = IMAP4_TLS_PORT, |
| 15 username=None, password=None, sharedKey=None, | 15 username=None, password=None, sharedKey=None, |
| 16 certChain=None, privateKey=None, | 16 certChain=None, privateKey=None, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 This connection will be used by the routines: | 122 This connection will be used by the routines: |
| 123 read, readline, send, shutdown. | 123 read, readline, send, shutdown. |
| 124 """ | 124 """ |
| 125 self.host = host | 125 self.host = host |
| 126 self.port = port | 126 self.port = port |
| 127 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 127 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 128 self.sock.connect((host, port)) | 128 self.sock.connect((host, port)) |
| 129 self.sock = TLSConnection(self.sock) | 129 self.sock = TLSConnection(self.sock) |
| 130 self.sock.closeSocket = True | 130 self.sock.closeSocket = True |
| 131 ClientHelper._handshake(self, self.sock) | 131 ClientHelper._handshake(self, self.sock) |
| 132 self.file = self.sock.makefile('rb') | 132 self.file = self.sock.makefile('rb') |
| OLD | NEW |