From d495538d55c723d8a088c32327258ce10c555a2e Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sat, 6 Jan 2024 14:45:26 +0100 Subject: Stop dumping parsed emails in the logs --- src/mail/mod.rs | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/mail') diff --git a/src/mail/mod.rs b/src/mail/mod.rs index 1836052..bb2f130 100644 --- a/src/mail/mod.rs +++ b/src/mail/mod.rs @@ -22,9 +22,6 @@ impl<'a> TryFrom<&'a [u8]> for IMF<'a> { type Error = (); fn try_from(body: &'a [u8]) -> Result, ()> { - eprintln!("---- BEGIN PARSED MESSAGE ----"); - let _ = std::io::stderr().write_all(body); - eprintln!("---- END PARSED MESSAGE ----"); let parsed = eml_codec::parse_message(body).or(Err(()))?.1; Ok(Self { raw: body, parsed }) } -- cgit v1.2.3 From f58904f5bb3dbd429555c406c867f850654843a6 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sat, 6 Jan 2024 18:01:44 +0100 Subject: Search can now filter on index data --- src/mail/mod.rs | 1 - src/mail/query.rs | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/mail') diff --git a/src/mail/mod.rs b/src/mail/mod.rs index bb2f130..37578b8 100644 --- a/src/mail/mod.rs +++ b/src/mail/mod.rs @@ -1,5 +1,4 @@ use std::convert::TryFrom; -use std::io::Write; pub mod incoming; pub mod mailbox; diff --git a/src/mail/query.rs b/src/mail/query.rs index 8de73e6..91bd6c1 100644 --- a/src/mail/query.rs +++ b/src/mail/query.rs @@ -19,6 +19,15 @@ pub enum QueryScope { Partial, Full, } +impl QueryScope { + pub fn union(&self, other: &QueryScope) -> QueryScope { + match (self, other) { + (QueryScope::Full, _) | (_, QueryScope::Full) => QueryScope::Full, + (QueryScope::Partial, _) | (_, QueryScope::Partial) => QueryScope::Partial, + (QueryScope::Index, QueryScope::Index) => QueryScope::Index, + } + } +} impl<'a, 'b> Query<'a, 'b> { pub async fn fetch(&self) -> Result>> { -- cgit v1.2.3 From 35fd24ee46d8162cffe3aebcb32d0db1f35bd220 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 8 Jan 2024 07:52:45 +0100 Subject: Add the ENABLE capability, reduce wild logging --- src/mail/mailbox.rs | 4 ++++ src/mail/user.rs | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'src/mail') diff --git a/src/mail/mailbox.rs b/src/mail/mailbox.rs index 2a0a24a..7eed34f 100644 --- a/src/mail/mailbox.rs +++ b/src/mail/mailbox.rs @@ -39,7 +39,11 @@ impl Mailbox { .await?; } + // @FIXME reporting through opentelemetry or some logs + // info on the "shape" of the mailbox would be welcomed + /* dump(&uid_index); + */ let mbox = RwLock::new(MailboxInternal { id, diff --git a/src/mail/user.rs b/src/mail/user.rs index da0d509..5af86d0 100644 --- a/src/mail/user.rs +++ b/src/mail/user.rs @@ -71,10 +71,15 @@ impl User { /// Opens an existing mailbox given its IMAP name. pub async fn open_mailbox(&self, name: &str) -> Result>> { let (mut list, ct) = self.load_mailbox_list().await?; + + //@FIXME it could be a trace or an opentelemtry trace thing. + // Be careful to not leak sensible data + /* eprintln!("List of mailboxes:"); for ent in list.0.iter() { eprintln!(" - {:?}", ent); } + */ if let Some((uidvalidity, Some(mbid))) = list.get_mailbox(name) { let mb = self.open_mailbox_by_id(mbid, uidvalidity).await?; -- cgit v1.2.3 From 558e32fbd27be9a81144571b4baf318293be1344 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 8 Jan 2024 11:13:13 +0100 Subject: UID sequence are now correctly fetched --- src/mail/snapshot.rs | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mail') diff --git a/src/mail/snapshot.rs b/src/mail/snapshot.rs index 0834f09..ed756b5 100644 --- a/src/mail/snapshot.rs +++ b/src/mail/snapshot.rs @@ -11,8 +11,6 @@ use super::unique_ident::UniqueIdent; /// state that is desynchronized with the real mailbox state. /// It's up to the user to choose when their snapshot must be updated /// to give useful information to their clients -/// -/// pub struct FrozenMailbox { pub mailbox: Arc, pub snapshot: UidIndex, -- cgit v1.2.3