Parser was not unregistering the 'readable' event listener from the old
socket, nor registering it to the new socket when setSocket() was
called. This caused event handling to stop during the STARTTLS handoff.
Signed-off-by: Kevin Locke <klocke@quantpost.com>
When connecting to a server that advertises LOGINDISABLED in its
CAPABILITIES before STARTTLS, the connection raises an error and
destroys the socket before completing STARTTLS. This is demonstrated in
the following debug output:
debug: [connection] Connected to host
debug: <= '* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED] Dovecot ready.'
debug: => 'A0 CAPABILITY'
debug: <= '* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED'
debug: <= 'A0 OK Pre-login capabilities listed, post-login capabilities have more.'
error: Error: Logging in is disabled on this server source=authentication
debug: [connection] Closed
It appears that a return after _starttls was overlooked (since _starttls
will call _login again once the STARTTLS has completed).
Signed-off-by: Kevin Locke <klocke@quantpost.com>
Some MUAs appear to break multi-byte characters across encoded word boundaries, which goes against RFC2047.
This change attempts to work around this by trying to concatenate broken encoded words that are separated by linear white space.
readable-stream proxies some events in wrap(). Since the Parser doesn't care about any events other than 'readable', we remove the troublesome proxied 'error' event.
Fixes#285
IMAP can subscribe to / unsubscribe from folders. Servers such as
Dovecot do not automatically subscribe to newly created mailboxes, you
must subscribe to them after creation.
subscribeBox - Subscribes to the specified box.
unsubcribeBox - Unsubscribes from the specified box.
getSubscribedBoxes - Issues a LSUB command to the server. Whilst LIST
returns all folders, LSUB only returns the folders the user has
subscribed to.