From c0c588be9c39e5b1d1b1537e76b3c9a605b5fc43 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Wed, 9 Sep 2020 22:53:12 +0300 Subject: [PATCH] melib/maildir: add message flag initialize in bytes Maildir flags from filesystem path was not set correctly on Envelope initialization in maildir backend --- melib/src/backends/maildir/backend.rs | 6 +++--- melib/src/backends/maildir/stream.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/melib/src/backends/maildir/backend.rs b/melib/src/backends/maildir/backend.rs index 1ff8a12c..b969acdb 100644 --- a/melib/src/backends/maildir/backend.rs +++ b/melib/src/backends/maildir/backend.rs @@ -280,7 +280,7 @@ impl MailBackend for MaildirType { } if let Ok(mut env) = Envelope::from_bytes( unsafe { &Mmap::open_path(&file, Protection::Read)?.as_slice() }, - None, + Some(file.flags()), ) { env.set_hash(hash); mailbox_index @@ -488,7 +488,7 @@ impl MailBackend for MaildirType { unsafe { &Mmap::open_path(&pathbuf, Protection::Read)?.as_slice() }, - None, + Some(pathbuf.flags()), ) { env.set_hash(new_hash); debug!("{}\t{:?}", new_hash, &pathbuf); @@ -1162,7 +1162,7 @@ fn add_path_to_index( //Mmap::open_path(self.path(), Protection::Read)? let mut env = Envelope::from_bytes( unsafe { &Mmap::open_path(path, Protection::Read)?.as_slice() }, - None, + Some(path.flags()), )?; env.set_hash(env_hash); debug!( diff --git a/melib/src/backends/maildir/stream.rs b/melib/src/backends/maildir/stream.rs index 56ee61cd..8fd59fc9 100644 --- a/melib/src/backends/maildir/stream.rs +++ b/melib/src/backends/maildir/stream.rs @@ -148,7 +148,7 @@ impl MaildirStream { } match Envelope::from_bytes( unsafe { &Mmap::open_path(&file, Protection::Read)?.as_slice() }, - None, + Some(file.flags()), ) { Ok(mut env) => { env.set_hash(env_hash);