Implement IMAP fetch internaldate

This commit is contained in:
Quentin 2022-06-30 15:22:25 +02:00
parent b15026ec9c
commit 7efe08a9b8
Signed by: quentin
GPG Key ID: E9602264D639FF68
3 changed files with 39 additions and 11 deletions

38
Cargo.lock generated
View File

@ -26,6 +26,7 @@ dependencies = [
"async-trait",
"base64",
"boitalettres",
"chrono",
"clap",
"duplexify",
"futures",
@ -247,6 +248,27 @@ dependencies = [
"wasm-bindgen-futures",
]
[[package]]
name = "async-stream"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e"
dependencies = [
"async-stream-impl",
"futures-core",
]
[[package]]
name = "async-stream-impl"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "async-task"
version = "4.2.0"
@ -403,10 +425,11 @@ dependencies = [
[[package]]
name = "boitalettres"
version = "0.0.1"
source = "git+https://git.deuxfleurs.fr/KokaKiwi/boitalettres.git?branch=main#01ee8c872b15e2aecb4c0ef5c2dd3aa6cc3c4d3c"
version = "0.1.0"
source = "git+https://git.deuxfleurs.fr/quentin/boitalettres.git?branch=expose-mydatetime#874fa91186989ced7ebac270f18b64e47ee4f98a"
dependencies = [
"async-compat",
"async-stream",
"bytes",
"futures",
"imap-codec",
@ -1130,8 +1153,7 @@ dependencies = [
[[package]]
name = "imap-codec"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab1edebd5f2288f8c195ae53fbb7342f5e568739b439a5923be21a9f61f3364"
source = "git+https://github.com/superboum/imap-codec.git?branch=v0.5.x#09f18cff93b7e17e5b84ab1fbf06b8d13b8e9e2d"
dependencies = [
"abnf-core",
"base64",
@ -1354,9 +1376,9 @@ dependencies = [
[[package]]
name = "miette"
version = "4.7.1"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c"
checksum = "6ec753a43fd71bb5f28751c9ec17fbe89d6d26ca8282d1e1f82f5ac3dbd5581e"
dependencies = [
"miette-derive",
"once_cell",
@ -1366,9 +1388,9 @@ dependencies = [
[[package]]
name = "miette-derive"
version = "4.7.1"
version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c"
checksum = "fdfc33ea15c5446600f91d319299dd40301614afff7143cdfa9bf4c09da3ca64"
dependencies = [
"proc-macro2",
"quote",

View File

@ -39,10 +39,12 @@ zstd = { version = "0.9", default-features = false }
tracing-subscriber = "0.3"
tracing = "0.1"
tower = "0.4"
imap-codec = "0.5"
imap-codec = { git = "https://github.com/superboum/imap-codec.git", branch = "v0.5.x" }
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
k2v-client = { git = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git", branch = "main" }
boitalettres = { git = "https://git.deuxfleurs.fr/KokaKiwi/boitalettres.git", branch = "main" }
boitalettres = { git = "https://git.deuxfleurs.fr/quentin/boitalettres.git", branch = "expose-mydatetime" }
smtp-message = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" }
smtp-server = { git = "http://github.com/Alexis211/kannader", branch = "feature/lmtp" }

View File

@ -4,8 +4,10 @@ use std::sync::Arc;
use anyhow::{anyhow, bail, Error, Result};
use boitalettres::proto::res::body::Data as Body;
use chrono::{Offset, Utc, TimeZone};
use futures::stream::{FuturesOrdered, StreamExt};
use imap_codec::types::address::Address;
use imap_codec::types::datetime::MyDateTime;
use imap_codec::types::core::{Atom, IString, NString, NonZeroBytes};
use imap_codec::types::envelope::Envelope;
use imap_codec::types::fetch_attributes::{FetchAttribute, MacroOrFetchAttributes};
@ -288,7 +290,9 @@ impl MailboxView {
todo!()
}
FetchAttribute::InternalDate => {
todo!()
attributes.push(MessageAttribute::InternalDate(
MyDateTime(Utc.fix().timestamp(i64::try_from(meta.internaldate / 1000)?, 0))
));
}
}
}