Skip to content

Commit a0c6104

Browse files
committed
feat: IMAP COMPRESS support
1 parent bfef129 commit a0c6104

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

Cargo.lock

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ratelimit = { path = "./deltachat-ratelimit" }
4141
anyhow = { workspace = true }
4242
async-broadcast = "0.7.1"
4343
async-channel = { workspace = true }
44-
async-imap = { version = "0.10.1", default-features = false, features = ["runtime-tokio"] }
44+
async-imap = { git = "https://github.com/async-email/async-imap.git", default-features = false, features = ["runtime-tokio", "compress"], branch = "link2xt/imap-compress" }
4545
async-native-tls = { version = "0.5", default-features = false, features = ["runtime-tokio"] }
4646
async-smtp = { version = "0.9", default-features = false, features = ["runtime-tokio"] }
4747
async_zip = { version = "0.0.12", default-features = false, features = ["deflate", "fs"] }

src/imap/client.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,14 @@ impl Client {
9090
.await
9191
.map_err(|(err, _client)| err)?;
9292
let capabilities = determine_capabilities(&mut session).await?;
93-
Ok(Session::new(session, capabilities))
93+
let compressed_session = session
94+
.compress(|s| {
95+
let session_stream: Box<dyn SessionStream> = Box::new(s);
96+
session_stream
97+
})
98+
.await?
99+
.unwrap();
100+
Ok(Session::new(compressed_session, capabilities))
94101
}
95102

96103
pub(crate) async fn authenticate(

src/net/session.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ impl<T: SessionStream> SessionStream for ShadowsocksStream<T> {
5050
self.stream.get_mut().set_read_timeout(timeout)
5151
}
5252
}
53+
impl<T: SessionStream> SessionStream for async_imap::deflate::DeflateStream<T> {
54+
fn set_read_timeout(&mut self, timeout: Option<Duration>) {
55+
//self.stream.get_mut().set_read_timeout(timeout)
56+
}
57+
}
5358

5459
/// Session stream with a read buffer.
5560
pub(crate) trait SessionBufStream: SessionStream + AsyncBufRead {}

0 commit comments

Comments
 (0)