From 9dee1784dfa395bd5655c3895bced18701106f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Tue, 14 May 2024 18:19:39 +0200 Subject: [PATCH] replace imap by imap-codec --- Cargo.lock | 396 ++++++++++++++++++++++++++++++++++++++++++----------- Cargo.toml | 10 +- 2 files changed, 324 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd13777..4e195a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,15 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +[[package]] +name = "abnf-core" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182d1f071b906a9f59269c89af101515a5cbe58f723eb6717e7fe7445c0dea" +dependencies = [ + "nom", +] + [[package]] name = "addr2line" version = "0.21.0" @@ -160,7 +169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "367fd0ad87307588d087544707bc5fbf4805ded96c7db922b70d368fa1cb5702" dependencies = [ "unicode-width", - "yansi 0.5.1", + "yansi", ] [[package]] @@ -186,6 +195,15 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-ctrlc" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "907279f6e91a51c8ec7cac24711e8308f21da7c10c7700ca2f7e125694ed2df1" +dependencies = [ + "ctrlc", +] + [[package]] name = "async-executor" version = "1.11.0" @@ -345,6 +363,33 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +[[package]] +name = "aws-lc-rs" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8487b59d62764df8231cb371c459314df895b41756df457a1fb1243d65c89195" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c15eb61145320320eb919d9bab524617a7aa4216c78d342fae3a758bc33073e4" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -390,6 +435,29 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.59", + "which", +] + [[package]] name = "bitfield" version = "0.14.0" @@ -474,6 +542,26 @@ dependencies = [ "cipher 0.4.4", ] +[[package]] +name = "bounded-static" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2325bd33fa7e3018e7e37f5b0591ba009124963b5a3f8b7cae6d0a8c1028ed4" +dependencies = [ + "bounded-static-derive", +] + +[[package]] +name = "bounded-static-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f10dd247355bf631d98d2753d87ae62c84c8dcb996ad9b24a4168e0aec29bd6b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.59", +] + [[package]] name = "bstr" version = "1.9.1" @@ -494,12 +582,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "bufstream" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" - [[package]] name = "build-rs" version = "0.1.2" @@ -574,6 +656,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfb-mode" version = "0.8.2" @@ -599,6 +690,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" version = "0.4.38" @@ -645,6 +742,17 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.5.4" @@ -705,6 +813,15 @@ dependencies = [ "roff", ] +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + [[package]] name = "color-eyre" version = "0.6.3" @@ -909,6 +1026,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "ctrlc" +version = "3.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345" +dependencies = [ + "nix 0.28.0", + "windows-sys 0.52.0", +] + [[package]] name = "curve25519-dalek" version = "4.1.2" @@ -1176,6 +1303,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "dyn-clone" version = "1.0.17" @@ -1250,10 +1383,10 @@ dependencies = [ [[package]] name = "email-lib" version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20eca48c1ae74c6c7ec6ef9a6c2af935e3cc601c50fce1385c24bec5dd5e20e9" +source = "git+https://git.sr.ht/~soywod/pimalaya#53d208ae1bca94d63485b6ad222fade4a94f510c" dependencies = [ "advisory-lock", + "async-ctrlc", "async-trait", "chrono", "chumsky", @@ -1265,10 +1398,8 @@ dependencies = [ "hickory-resolver", "hyper", "hyper-rustls", - "imap", - "imap-proto", + "imap-client", "keyring-lib", - "log", "mail-builder", "mail-parser", "mail-send", @@ -1279,7 +1410,7 @@ dependencies = [ "notmuch", "oauth-lib", "once_cell", - "ouroboros 0.15.6", + "ouroboros", "paste", "pgp-lib", "process-lib", @@ -1292,6 +1423,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls 0.25.0", + "tracing", "tree_magic_mini", "urlencoding", "utf7-imap", @@ -1563,6 +1695,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.30" @@ -1738,6 +1876,12 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "gpg-error" version = "0.6.1" @@ -2108,29 +2252,60 @@ dependencies = [ ] [[package]] -name = "imap" -version = "3.0.0-alpha.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd82d66124b97aabeba7a4744b82bf244160e56611d8be9f89b74ed4ee481f1e" +name = "imap-client" +version = "0.1.0" +source = "git+https://github.com/soywod/imap-flow.git?branch=session#599cedbf9facd7d04eaacef2ec6710ee7f7f9eff" dependencies = [ - "base64 0.22.0", - "bufstream", - "chrono", - "imap-proto", - "lazy_static", - "nom", - "ouroboros 0.18.3", - "regex", - "rustls-connector", + "imap-flow", + "once_cell", + "rustls-native-certs 0.7.0", + "tasks", + "thiserror", + "tokio", + "tokio-rustls 0.26.0", + "tracing", ] [[package]] -name = "imap-proto" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305c25c6e69416059e3396c4a062b84dc7b0a782cd4c84d82bab268eb0421ec7" +name = "imap-codec" +version = "2.0.0" +source = "git+https://github.com/duesee/imap-codec.git#d6b265fd01123334db2d48100537eb140932589c" dependencies = [ + "abnf-core", + "base64 0.21.7", + "bounded-static", + "chrono", + "imap-types", + "log", "nom", + "thiserror", +] + +[[package]] +name = "imap-flow" +version = "0.1.0" +source = "git+https://github.com/soywod/imap-flow.git?branch=session#599cedbf9facd7d04eaacef2ec6710ee7f7f9eff" +dependencies = [ + "bounded-static", + "bytes", + "imap-codec", + "imap-types", + "rustls 0.23.5", + "thiserror", + "tokio", + "tokio-rustls 0.26.0", + "tracing", +] + +[[package]] +name = "imap-types" +version = "2.0.0" +source = "git+https://github.com/duesee/imap-codec.git#d6b265fd01123334db2d48100537eb140932589c" +dependencies = [ + "base64 0.21.7", + "bounded-static", + "chrono", + "thiserror", ] [[package]] @@ -2342,6 +2517,12 @@ dependencies = [ "spin 0.5.2", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.153" @@ -2359,6 +2540,16 @@ dependencies = [ "winreg 0.52.0", ] +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + [[package]] name = "libm" version = "0.2.8" @@ -2608,6 +2799,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "mml-lib" version = "1.0.12" @@ -2657,6 +2854,18 @@ dependencies = [ "memoffset 0.7.1", ] +[[package]] +name = "nix" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nom" version = "7.1.3" @@ -2966,18 +3175,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db" dependencies = [ "aliasable", - "ouroboros_macro 0.15.6", -] - -[[package]] -name = "ouroboros" -version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b7be5a8a3462b752f4be3ff2b2bf2f7f1d00834902e46be2a4d68b87b0573c" -dependencies = [ - "aliasable", - "ouroboros_macro 0.18.3", - "static_assertions", + "ouroboros_macro", ] [[package]] @@ -2993,20 +3191,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ouroboros_macro" -version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645dcde5f119c2c454a92d0dfa271a2a3b205da92e4292a68ead4bdbfde1f33" -dependencies = [ - "heck 0.4.1", - "itertools", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn 2.0.59", -] - [[package]] name = "overload" version = "0.1.1" @@ -3329,6 +3513,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.59", +] + [[package]] name = "primeorder" version = "0.13.6" @@ -3381,19 +3575,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc-macro2-diagnostics" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.59", - "version_check", - "yansi 1.0.1", -] - [[package]] name = "process-lib" version = "0.4.2" @@ -3711,6 +3892,12 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -3774,16 +3961,18 @@ dependencies = [ ] [[package]] -name = "rustls-connector" -version = "0.19.2" +name = "rustls" +version = "0.23.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5bd40675c79c896f46d0031bf64c448b35e583dd2bc949751ddd800351e453a" +checksum = "afabcee0551bd1aa3e18e5adbf2c0544722014b899adb31bd186ec638d3da97e" dependencies = [ + "aws-lc-rs", "log", - "rustls 0.22.3", - "rustls-native-certs 0.7.0", + "once_cell", "rustls-pki-types", "rustls-webpki 0.102.2", + "subtle", + "zeroize", ] [[package]] @@ -3852,6 +4041,7 @@ version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ + "aws-lc-rs", "ring 0.17.8", "rustls-pki-types", "untrusted 0.9.0", @@ -4135,6 +4325,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook" version = "0.3.17" @@ -4346,12 +4542,33 @@ dependencies = [ "version-compare", ] +[[package]] +name = "tag-generator" +version = "0.1.0" +source = "git+https://github.com/soywod/imap-flow.git?branch=session#599cedbf9facd7d04eaacef2ec6710ee7f7f9eff" +dependencies = [ + "imap-types", + "rand", +] + [[package]] name = "target-lexicon" version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" +[[package]] +name = "tasks" +version = "0.1.0" +source = "git+https://github.com/soywod/imap-flow.git?branch=session#599cedbf9facd7d04eaacef2ec6710ee7f7f9eff" +dependencies = [ + "imap-flow", + "imap-types", + "tag-generator", + "thiserror", + "tracing", +] + [[package]] name = "tauri-winrt-notification" version = "0.1.3" @@ -4518,6 +4735,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.5", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -4929,6 +5157,18 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.32", +] + [[package]] name = "widestring" version = "1.1.0" @@ -5214,12 +5454,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" - [[package]] name = "z-base-32" version = "0.1.4" @@ -5250,7 +5484,7 @@ dependencies = [ "futures-sink", "futures-util", "hex", - "nix", + "nix 0.26.4", "once_cell", "ordered-stream", "rand", diff --git a/Cargo.toml b/Cargo.toml index ca4db63..fea7b4a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ color-eyre = "0.6.3" console = "0.15.2" dialoguer = "0.10.2" dirs = "4" -email-lib = { version = "=0.24.1", default-features = false, features = ["derive"] } +email-lib = { version = "=0.24.1", default-features = false, features = ["derive", "tracing"] } email_address = "0.2.4" erased-serde = "0.3" indicatif = "0.17" @@ -83,3 +83,11 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } unicode-width = "0.1" url = "2.2" uuid = { version = "0.8", features = ["v4"] } + +[patch.crates-io] +# WIP: transition from `imap` to `imap-codec` +email-lib = { git = "https://git.sr.ht/~soywod/pimalaya" } +imap-client = { git = "https://github.com/soywod/imap-flow.git", branch = "session" } +tasks = { git = "https://github.com/soywod/imap-flow.git", branch = "session" } +imap-codec = { git = "https://github.com/duesee/imap-codec.git" } +imap-types = { git = "https://github.com/duesee/imap-codec.git" }