Skip to content

Commit

Permalink
Undelete emails 💎 (closes #589)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Jul 7, 2024
1 parent af89725 commit 14224c5
Show file tree
Hide file tree
Showing 27 changed files with 526 additions and 39 deletions.
32 changes: 18 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Stalwart Labs Ltd. <[email protected]>"]
license = "AGPL-3.0-only OR LicenseRef-SEL"
repository = "https://github.com/stalwartlabs/cli"
homepage = "https://github.com/stalwartlabs/cli"
version = "0.8.4"
version = "0.8.5"
edition = "2021"
readme = "README.md"
resolver = "2"
Expand Down
2 changes: 1 addition & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "common"
version = "0.8.4"
version = "0.8.5"
edition = "2021"
resolver = "2"

Expand Down
12 changes: 10 additions & 2 deletions crates/common/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/

use std::sync::Arc;
use std::{sync::Arc, time::Duration};

use arc_swap::ArcSwap;
use directory::{Directories, Directory};
Expand Down Expand Up @@ -149,7 +149,15 @@ impl Core {
}
None
}
_ => Some(Enterprise { license }),
_ => Some(Enterprise {
license,
undelete_period: config
.property_or_default::<Option<Duration>>(
"enterprise.undelete-period",
"false",
)
.unwrap_or_default(),
}),
}
}
Some(Err(e)) => {
Expand Down
3 changes: 2 additions & 1 deletion crates/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/

use std::{borrow::Cow, net::IpAddr, sync::Arc};
use std::{borrow::Cow, net::IpAddr, sync::Arc, time::Duration};

use arc_swap::ArcSwap;
use config::{
Expand Down Expand Up @@ -88,6 +88,7 @@ pub struct Network {
#[derive(Clone)]
pub struct Enterprise {
pub license: LicenseKey,
pub undelete_period: Option<Duration>,
}

// SPDX-SnippetEnd
Expand Down
2 changes: 1 addition & 1 deletion crates/directory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "directory"
version = "0.8.4"
version = "0.8.5"
edition = "2021"
resolver = "2"

Expand Down
2 changes: 1 addition & 1 deletion crates/imap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "imap"
version = "0.8.4"
version = "0.8.5"
edition = "2021"
resolver = "2"

Expand Down
23 changes: 22 additions & 1 deletion crates/jmap-proto/src/types/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/

use std::fmt::{self, Display, Formatter};
use std::{
fmt::{self, Display, Formatter},
str::FromStr,
};

use utils::map::bitmap::BitmapItem;

Expand Down Expand Up @@ -101,6 +104,24 @@ impl Display for Collection {
}
}

impl FromStr for Collection {
type Err = ();

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"pushSubscription" => Ok(Collection::PushSubscription),
"email" => Ok(Collection::Email),
"mailbox" => Ok(Collection::Mailbox),
"thread" => Ok(Collection::Thread),
"identity" => Ok(Collection::Identity),
"emailSubmission" => Ok(Collection::EmailSubmission),
"sieveScript" => Ok(Collection::SieveScript),
"principal" => Ok(Collection::Principal),
_ => Err(()),
}
}
}

impl BitmapItem for Collection {
fn max() -> u64 {
Collection::None as u64
Expand Down
3 changes: 2 additions & 1 deletion crates/jmap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jmap"
version = "0.8.4"
version = "0.8.5"
edition = "2021"
resolver = "2"

Expand All @@ -11,6 +11,7 @@ jmap_proto = { path = "../jmap-proto" }
smtp = { path = "../smtp" }
utils = { path = "../utils" }
common = { path = "../common" }
se_common = { path = "../se-common" }
directory = { path = "../directory" }
smtp-proto = { version = "0.1" }
mail-parser = { version = "0.9", features = ["full_encoding", "serde_support", "ludicrous_mode"] }
Expand Down
Loading

0 comments on commit 14224c5

Please sign in to comment.