aboutsummaryrefslogtreecommitdiff
path: root/src/mail
diff options
context:
space:
mode:
Diffstat (limited to 'src/mail')
-rw-r--r--src/mail/mailbox.rs4
-rw-r--r--src/mail/mod.rs4
-rw-r--r--src/mail/query.rs9
-rw-r--r--src/mail/snapshot.rs2
-rw-r--r--src/mail/user.rs5
5 files changed, 18 insertions, 6 deletions
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/mod.rs b/src/mail/mod.rs
index 1836052..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;
@@ -22,9 +21,6 @@ impl<'a> TryFrom<&'a [u8]> for IMF<'a> {
type Error = ();
fn try_from(body: &'a [u8]) -> Result<IMF<'a>, ()> {
- 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 })
}
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<Vec<QueryResult<'a>>> {
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<Mailbox>,
pub snapshot: UidIndex,
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<Option<Arc<Mailbox>>> {
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?;