Explorar el Código

WIP upgrade dependencies

alex wennerberg hace 4 meses
padre
commit
701d7e66c7
Se han modificado 6 ficheros con 117 adiciones y 28 borrados
  1. 104 15
      Cargo.lock
  2. 5 6
      Cargo.toml
  3. 2 2
      src/config.rs
  4. 4 2
      src/main.rs
  5. 1 2
      src/models.rs
  6. 1 1
      src/threading.rs

+ 104 - 15
Cargo.lock

@@ -4,9 +4,15 @@ version = 3
 
 [[package]]
 name = "anyhow"
-version = "1.0.56"
+version = "1.0.82"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
+checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
 [[package]]
 name = "crabmail"
@@ -16,28 +22,60 @@ dependencies = [
  "linkify",
  "mail-builder",
  "mail-parser",
- "once_cell",
  "urlencoding",
 ]
 
+[[package]]
+name = "encoding_rs"
+version = "0.8.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "gethostname"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
+dependencies = [
+ "libc",
+ "windows-targets",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.153"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
+
 [[package]]
 name = "linkify"
-version = "0.8.0"
+version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccbcd666d915aa3ae3c3774999a9e20b2776a018309b8159d07df062b91f45e8"
+checksum = "f1dfa36d52c581e9ec783a7ce2a5e0143da6237be5811a0b3153fedfdbe9f780"
 dependencies = [
  "memchr",
 ]
 
 [[package]]
 name = "mail-builder"
-version = "0.1.3"
-source = "git+https://github.com/alexwennerberg/mail-builder#f276c3625316cafb5708547b188f62112f64ab27"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef70f53409852d2612f2249810cbbe0c9931ca25b739b734bafc7f61d88051d4"
+dependencies = [
+ "gethostname",
+]
 
 [[package]]
 name = "mail-parser"
-version = "0.4.8"
-source = "git+https://github.com/stalwartlabs/mail-parser#0064d3443a67c2f50e462e6c2339505463980d8e"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5a1335c3a964788c90cb42ae04a34b5f2628e89566949ce3bd4ada695c0bcd"
+dependencies = [
+ "encoding_rs",
+]
 
 [[package]]
 name = "memchr"
@@ -46,13 +84,64 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
 
 [[package]]
-name = "once_cell"
-version = "1.10.0"
+name = "urlencoding"
+version = "2.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
+checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
 
 [[package]]
-name = "urlencoding"
-version = "2.1.0"
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"

+ 5 - 6
Cargo.toml

@@ -8,10 +8,9 @@ edition = "2018"
 default = []
 
 [dependencies]
-anyhow = "1.0.52"
-linkify = "0.8.0" 
+anyhow = "1.0.82"
+linkify = "0.10.0"
 # using my fork just to upstream patches faster.
-mail-builder = {git = "https://github.com/alexwennerberg/mail-builder"}
-mail-parser = { git = "https://github.com/stalwartlabs/mail-parser", default-features=false, tag = "0.8.2" }
-once_cell = "1.9.0"
-urlencoding = "2.1.0"
+mail-builder = "0.3.1"
+mail-parser = "0.9.3"
+urlencoding = "2.1.3"

+ 2 - 2
src/config.rs

@@ -10,7 +10,7 @@
 // NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
 // OF THIS SOFTWARE.
 
-use once_cell::sync::OnceCell;
+use std::sync::OnceLock;
 use std::fs::File;
 use std::io::{self, BufRead};
 use std::path::{Path, PathBuf};
@@ -66,7 +66,7 @@ impl Subsection {
     }
 }
 
-pub static INSTANCE: OnceCell<Config> = OnceCell::new();
+pub static INSTANCE: OnceLock<Config> = OnceLock::new();
 
 impl Config {
     pub fn global() -> &'static Config {

+ 4 - 2
src/main.rs

@@ -97,7 +97,8 @@ impl List {
         msgs.reverse();
         for m in msgs.iter().take(ATOM_ENTRY_LIMIT) {
             let data = std::fs::read(&m.path).unwrap();
-            let msg = StrMessage::new(&Message::parse(&data).unwrap());
+            let parser = mail_parser::MessageParser::new();
+            let msg = StrMessage::new(&parser.parse(&data).unwrap());
             out.push(msg);
         }
         out
@@ -208,7 +209,8 @@ fn main() {
             let path = entry.path().to_path_buf();
             let data = std::fs::read(&path).expect("could not read mail");
 
-            if let Some(mail) = mail_parser::Message::parse(&data) {
+            let parser = mail_parser::MessageParser::new();
+            if let Some(mail) = parser.parse(&data) {
                 list.add_email(&mail, path);
             } else {
                 println!("Could not parse message {:?}", path);

+ 1 - 2
src/models.rs

@@ -255,8 +255,7 @@ impl StrMessage {
 
         // life is a nightmare
         let flowed = msg
-            .text_part(0)
-            .and_then(|x| x.headers.get(&RfcHeader::ContentType))
+            .header(&RfcHeader::ContentType)
             .and_then(|x| x.as_content_type_ref())
             .and_then(|x| x.attributes.as_ref())
             .and_then(|x| x.get("format"))

+ 1 - 1
src/threading.rs

@@ -41,7 +41,7 @@ impl ThreadIdx {
         };
         let time = match msg
             .received()
-            .as_datetime_ref()
+            .date()
             .or_else(|| msg.date())
         {
             Some(t) => t.clone(),