mscdex / node-imap

An IMAP client module for node.js.
MIT License
2.15k stars 380 forks source link

Talk IMAP over any duplex stream? #618

Open mk-pmb opened 7 years ago

mk-pmb commented 7 years ago

Hi, thanks for providing an abstraction to the IMAP protocol!

To me the readme looks like the IMAP stuff is mixed up with lots of TCP and TLS stuff though, is that right? I can't even find an API for how to pass my duplex stream that has my IMAP server on the other side. Did I miss something then? Can this module talk to my IMAP server over any duplex stream?

lib/Connection.js ln 102 looks like there's an undocumented socket option in the config object, but the very next line makes clear that it expects socket-specific features that arbitrary duplex streams don't usually have.

Are there special reasons why an IMAP module should care about the transport layer, or could (should?) we refactor the transport stuff to some other module someday?

mscdex commented 7 years ago

FWIW that undocumented option was added by someone else in https://github.com/mscdex/node-imap/pull/388.

Historically speaking, one reason arbitrary streams are not supported is because that's not a common use case.

mk-pmb commented 7 years ago

I guess that implieas there are no intentional reasons. Would you be willing to maintain a branch that uses duplex streams, if someone were to refactor the module?

mscdex commented 7 years ago

I dunno at this point. What is your use case anyway?

mk-pmb commented 7 years ago

Currently, IMAP over unix domain socket, using the file system for access control. Will probably evolve to