These messages show up at an interval controlled by Dovecot's
imap_idle_notify_interval setting, which defaults to 2 minutes.
These messages were causing the IDLE loop to exit prematurely
because it looks like a notification response from the server.
Add a `imap::connect_starttls` convenience function, with the same
syntax as `imap::connect`, to make STARTTLS connections as easily as
IMAPS.
PR#140 removed `imap::connect_insecure` with the stated goal of
encouraging users to connect securely. With that change, users are
forced to construct their own `TcpStream`s when interacting with
non-IMAPS servers.
This change may perversely incentivise the use of insecure connections,
instead of discouraging them, as users may blindly copy-paste code
involving `Client::new` and `TcpStream`s so things "just work", without
the visual indicator of `_insecure` suggesting something is wrong.
Tangentially, [RFC 2595] encourages using STARTTLS instead of raw SSL
sockets. Ideally, we should support both options equally well.
[RFC 2595]: https://tools.ietf.org/html/rfc2595#section-7
In order to discourage folks from connecting securely, we're removing the
convenience method imap::connect_insecure.
Fear not\! For those who manage security in another way (aka a private network
or similar measures), it is still possible to connect without TLS by using the
imap::Client::new() method. See that method for examples of how to do this.
Establishes conditional compilation for all integration with the
native_tls crate in this crate. Since native_tls has been deeply
integrated into this crate for a long time, we want to maintain
backwards compatibility by making this feature part of the default.
For a consumer of this crate to "opt-out", including this in
cargo.toml:
```
[dependencies.imap]
version = 0.16.0 # Replace this with the correct version
default-features = false
```
See the conversation on Github for details on this approach:
https://github.com/jonhoo/rust-imap/issues/123
The underlying Rust library for crypto `ring` using multiple
`#[cfg_attr()]` properties together which stabilized in rust 1.33.0:
https://github.com/rust-lang/rust/blob/stable/RELEASES.md#language-4
Previously, everything else in this could be compiled with rust 1.32.0,
so this may constitute a breaking change.
By checking this code in as an example, we can prevent bitrot as we continuously test this
in CI. It also demonstrates how to setup TLS without relying on platform specific dependencies
via native_tls crate.