bamthomas / aioimaplib

Python asyncio IMAP4rev1 client library
GNU General Public License v3.0
134 stars 59 forks source link

Lost connection callback for IMAP4_SSL #107

Open brettk-git opened 1 month ago

brettk-git commented 1 month ago

The IMAP4 class constructor has a conn_lost_cb parameter. Strangely enough the IMAP4_SSL class constructor does not have one, and it passes None as the conn_lost_cb parameter to the IMAP4 constructor. This is annoying when one does want to use a callback to handle an IMAP4 SSL connection loss. By just adding this parameter to the IMAP4_SSL constructor like this

    def __init__(self, host: str = '127.0.0.1', port: int = IMAP4_SSL_PORT, loop: asyncio.AbstractEventLoop = None,
                 timeout: float = IMAP4.TIMEOUT_SECONDS, conn_lost_cb: Callable[[Optional[Exception]], None] = None, ssl_context: ssl.SSLContext = None):
        super().__init__(host, port, loop, timeout, conn_lost_cb, ssl_context)

I have been able to use it with success and no visible downside, so I would suggest incorporating this modification into the source code.

brettk-git commented 1 month ago

sorry, misclicked, did not mean to close...