diff --git a/Cargo.lock b/Cargo.lock index 59c9036d5..0bba9e3bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,9 +165,9 @@ dependencies = [ [[package]] name = "async-imap" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c082ecb52ec3af0aa61d4314750086134ef9c7521edb41f7981c0f45650c0c7b" +checksum = "caadebe62f5ad78d6418a47a86b5b84439a52bdd5c893e55a5c81974da111455" dependencies = [ "async-native-tls", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 50617bf30..6d200648b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ num-traits = "0.2.6" async-smtp = "0.3" email = { git = "https://github.com/deltachat/rust-email", branch = "master" } lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" } -async-imap = "0.3.1" +async-imap = "0.4.0" async-native-tls = { version = "0.3.3" } async-std = { version = "1.6.1", features = ["unstable"] } base64 = "0.12" diff --git a/src/imap/client.rs b/src/imap/client.rs index 2ee8165d1..d313db80b 100644 --- a/src/imap/client.rs +++ b/src/imap/client.rs @@ -56,7 +56,7 @@ impl Client { pub async fn authenticate>( self, auth_type: S, - authenticator: &A, + authenticator: A, ) -> std::result::Result { let Client { inner, is_secure } = self; let session = @@ -85,9 +85,6 @@ impl Client { let tls_stream: Box = Box::new(tls.connect(domain.as_ref(), stream).await?); let mut client = ImapClient::new(tls_stream); - if std::env::var(crate::DCC_IMAP_DEBUG).is_ok() { - client.debug = true; - } let _greeting = client .read_response() @@ -104,9 +101,6 @@ impl Client { let stream: Box = Box::new(TcpStream::connect(addr).await?); let mut client = ImapClient::new(stream); - if std::env::var(crate::DCC_IMAP_DEBUG).is_ok() { - client.debug = true; - } let _greeting = client .read_response() .await diff --git a/src/imap/mod.rs b/src/imap/mod.rs index ef4ea8b09..384c76111 100644 --- a/src/imap/mod.rs +++ b/src/imap/mod.rs @@ -129,7 +129,7 @@ struct OAuth2 { impl async_imap::Authenticator for OAuth2 { type Response = String; - fn process(&self, _data: &[u8]) -> Self::Response { + fn process(&mut self, _data: &[u8]) -> Self::Response { format!( "user={}\x01auth=Bearer {}\x01\x01", self.user, self.access_token @@ -262,7 +262,7 @@ impl Imap { user: imap_user.into(), access_token: token, }; - client.authenticate("XOAUTH2", &auth).await + client.authenticate("XOAUTH2", auth).await } else { return Err(Error::OauthError); }