Skip to content

Commit

Permalink
email: bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Dec 6, 2024
1 parent 6aa2d32 commit 6b981f1
Show file tree
Hide file tree
Showing 21 changed files with 172 additions and 77 deletions.
48 changes: 35 additions & 13 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,6 @@ dependencies = [
"hickory-resolver",
"http-lib",
"imap-client",
"imap-next",
"keyring-lib",
"mail-builder",
"mail-parser",
Expand Down Expand Up @@ -3341,17 +3340,17 @@ dependencies = [

[[package]]
name = "imap-client"
version = "0.1.5"
source = "git+https://github.com/pimalaya/imap-client#bca4048458585a4c3ed8e0fc71b82f8835ab8286"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd76710ea4d32c874d42a666d71800ba92f29ef4ba8eed3f6f717f5d14b17d1e"
dependencies = [
"futures-util",
"imap-next",
"rustls-platform-verifier",
"start-tls",
"rip-starttls",
"rustls-platform-verifier 0.4.0",
"thiserror 2.0.3",
"tokio",
"tokio-native-tls",
"tokio-rustls 0.26.0",
"tokio-util",
"tracing",
]

Expand All @@ -3371,12 +3370,15 @@ dependencies = [

[[package]]
name = "imap-next"
version = "0.3.0"
source = "git+https://github.com/soywod/imap-next?branch=jakoschiko_futures-stream-without-split#5addf10140ce81e906f114ca2fc767b1c69428a4"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d85520e742d9e8d9edbf9df9e0876f560ed08650db8f9de562bc7cd46b9b43"
dependencies = [
"futures-util",
"bytes",
"imap-codec",
"thiserror 1.0.69",
"thiserror 2.0.3",
"tokio",
"tokio-rustls 0.26.0",
"tracing",
]

Expand Down Expand Up @@ -6026,6 +6028,27 @@ dependencies = [
"winapi",
]

[[package]]
name = "rustls-platform-verifier"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c7dc240fec5517e6c4eab3310438636cfe6391dfc345ba013109909a90d136"
dependencies = [
"core-foundation 0.9.4",
"core-foundation-sys",
"jni",
"log",
"once_cell",
"rustls 0.23.19",
"rustls-native-certs 0.7.3",
"rustls-platform-verifier-android",
"rustls-webpki 0.102.8",
"security-framework 2.11.1",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.52.0",
]

[[package]]
name = "rustls-platform-verifier-android"
version = "0.1.1"
Expand Down Expand Up @@ -7102,7 +7125,6 @@ checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
dependencies = [
"bytes",
"futures-core",
"futures-io",
"futures-sink",
"pin-project-lite",
"tokio",
Expand Down Expand Up @@ -7491,7 +7513,7 @@ dependencies = [
"rustls 0.23.19",
"rustls-pemfile 2.2.0",
"rustls-pki-types",
"rustls-platform-verifier",
"rustls-platform-verifier 0.3.4",
"ureq-proto",
"utf-8",
"webpki-root-certs",
Expand Down
8 changes: 3 additions & 5 deletions email/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ full = [
imap = [
"dep:utf7-imap",
"dep:imap-client",
"dep:imap-next",
"tokio?/sync",
]

Expand Down Expand Up @@ -124,8 +123,8 @@ pgp-native = ["dep:pgp-lib", "dep:keyring-lib", "mml-lib/pgp-native", "pgp"]
#
#async-std-rustls = ["async-std", "rustls"]
#async-std-native-tls = ["async-std", "native-tls"]
tokio-rustls = ["dep:tokio-rustls", "tokio", "rustls"]
tokio-native-tls = ["dep:tokio-native-tls", "tokio", "native-tls"]
tokio-rustls = ["dep:tokio-rustls", "imap-client?/tokio-rustls", "tokio", "rustls"]
tokio-native-tls = ["dep:tokio-native-tls", "imap-client?/tokio-native-tls", "tokio", "native-tls"]

# Async runtime
#
Expand Down Expand Up @@ -158,8 +157,7 @@ email_address = { version = "0.2", optional = true, default-features = false }
futures = "0.3"
hickory-resolver = { version = "0.24", optional = true }
http-lib = { version = "0.1", optional = true, default-features = false, path = "../http" }
imap-client = { version = "=0.1.5", git = "https://github.com/pimalaya/imap-client", optional = true }
imap-next = { version = "0.3", git = "https://github.com/soywod/imap-next", branch = "jakoschiko_futures-stream-without-split", optional = true, features = ["expose_stream", "tag_generator", "starttls", "ext_id", "ext_metadata"] }
imap-client = { version = "0.2", optional = true }
keyring-lib = { version = "1", optional = true, default-features = false, path = "../keyring" }
mail-builder = "0.3"
mail-parser = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/envelope/flag/add/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/email/envelope/flag/imap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::fmt;

use imap_next::imap_types::{
use imap_client::imap_next::imap_types::{
error::ValidationError,
flag::{Flag as ImapFlag, FlagFetch},
search::SearchKey,
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/envelope/flag/remove/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::debug;
use tracing::info;
use utf7_imap::encode_utf7_imap as encode_utf7;
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/envelope/flag/set/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/email/envelope/imap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::{collections::HashMap, num::NonZeroU32};

use imap_next::imap_types::{
use imap_client::imap_next::imap_types::{
body::{BodyStructure, Disposition},
core::Vec1,
fetch::{MacroOrMessageDataItemNames, MessageDataItem, MessageDataItemName},
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/envelope/list/imap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::HashMap, num::NonZeroU32, result};
use async_trait::async_trait;
use chrono::TimeDelta;
use futures::{stream::FuturesUnordered, StreamExt};
use imap_next::imap_types::{
use imap_client::imap_next::imap_types::{
core::Vec1,
extensions::sort::{SortCriterion, SortKey},
search::SearchKey,
Expand Down
4 changes: 2 additions & 2 deletions email/src/email/envelope/thread/imap.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::num::NonZeroU32;

use async_trait::async_trait;
use imap_next::imap_types::{
use imap_client::imap_next::imap_types::{
extensions::thread::Thread,
search::SearchKey,
sequence::{Sequence, SequenceSet},
Expand Down Expand Up @@ -243,7 +243,7 @@ fn build_children_graph(
mod test {
use std::num::NonZeroU32;

use imap_next::imap_types::{
use imap_client::imap_next::imap_types::{
core::{Vec1, Vec2},
extensions::thread::Thread,
};
Expand Down
18 changes: 12 additions & 6 deletions email/src/email/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{any::Any, io, path::PathBuf, result};

use chumsky::error::Rich;
#[cfg(feature = "imap")]
use imap_next::imap_types::error::ValidationError;
use imap_client::imap_next::imap_types::error::ValidationError;
use thiserror::Error;
use tokio::task::JoinError;

Expand All @@ -22,15 +22,21 @@ pub enum Error {
#[cfg(feature = "imap")]
#[error("cannot sort IMAP ids using {1:?} and {2:?}")]
SortUidsError(
#[source] imap_client::ClientError,
imap_next::imap_types::core::Vec1<imap_next::imap_types::search::SearchKey<'static>>,
imap_next::imap_types::core::Vec1<imap_next::imap_types::extensions::sort::SortCriterion>,
#[source] imap_client::client::tokio::ClientError,
imap_client::imap_next::imap_types::core::Vec1<
imap_client::imap_next::imap_types::search::SearchKey<'static>,
>,
imap_client::imap_next::imap_types::core::Vec1<
imap_client::imap_next::imap_types::extensions::sort::SortCriterion,
>,
),
#[cfg(feature = "imap")]
#[error("cannot search IMAP ids using {1:?}")]
SearchUidsError(
#[source] imap_client::ClientError,
imap_next::imap_types::core::Vec1<imap_next::imap_types::search::SearchKey<'static>>,
#[source] imap_client::client::tokio::ClientError,
imap_client::imap_next::imap_types::core::Vec1<
imap_client::imap_next::imap_types::search::SearchKey<'static>,
>,
),

#[cfg(feature = "imap")]
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/copy/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/get/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/imap.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use imap_next::imap_types::fetch::{
use imap_client::imap_next::imap_types::fetch::{
MacroOrMessageDataItemNames, MessageDataItem, MessageDataItemName,
};
use once_cell::sync::Lazy;
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::{
};

#[cfg(feature = "imap")]
use imap_next::imap_types::{core::Vec1, fetch::MessageDataItem};
use imap_client::imap_next::imap_types::{core::Vec1, fetch::MessageDataItem};
use mail_parser::{MessageParser, MimeHeaders, PartType};
#[cfg(feature = "maildir")]
use maildirs::MaildirEntry;
Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/move/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/peek/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/email/message/remove/imap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use imap_next::imap_types::sequence::{Sequence, SequenceSet};
use imap_client::imap_next::imap_types::sequence::{Sequence, SequenceSet};
use tracing::{debug, info};
use utf7_imap::encode_utf7_imap as encode_utf7;

Expand Down
2 changes: 1 addition & 1 deletion email/src/folder/imap.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use imap_next::imap_types::{
use imap_client::imap_next::imap_types::{
core::{Atom, QuotedChar},
flag::FlagNameAttribute,
mailbox::Mailbox,
Expand Down
32 changes: 32 additions & 0 deletions email/src/imap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ pub struct ImapConfig {
)]
pub encryption: Option<ImapEncryptionKind>,

/// The IMAP TLS provider to use.
#[cfg_attr(feature = "derive", serde(default))]
pub tls_provider: ImapTlsProvider,

/// The IMAP server login.
///
/// Usually, the login is either the email address or its left
Expand Down Expand Up @@ -122,6 +126,34 @@ impl crate::sync::hash::SyncHash for ImapConfig {
}
}

#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(
feature = "derive",
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "kebab-case")
)]
pub enum ImapTlsProvider {
#[cfg(feature = "rustls")]
#[default]
Rustls,
#[cfg(feature = "native-tls")]
NativeTls,
#[cfg_attr(not(feature = "rustls"), default)]
None,
}

impl fmt::Display for ImapTlsProvider {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
#[cfg(feature = "rustls")]
Self::Rustls => write!(f, "Rust native (rustls)"),
#[cfg(feature = "native-tls")]
Self::NativeTls => write!(f, "OS native (native-tls)"),
Self::None => write!(f, "None"),
}
}
}

#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[cfg_attr(
feature = "derive",
Expand Down
12 changes: 8 additions & 4 deletions email/src/imap/error.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use std::{any::Any, collections::HashSet, result};

use imap_client::ClientError;
use imap_next::{
client::Error as ClientFlowError,
imap_types::{auth::AuthMechanism, error::ValidationError},
use imap_client::{
client::tokio::ClientError,
imap_next::{
client::Error as ClientFlowError,
imap_types::{auth::AuthMechanism, error::ValidationError},
},
stream::Error as StreamError,
};
use thiserror::Error;
Expand All @@ -17,6 +19,8 @@ pub type Result<T> = result::Result<T, Error>;
/// The global `Error` enum of the module.
#[derive(Debug, Error)]
pub enum Error {
#[error("cannot build IMAP client: missing TLS provider")]
BuildTlsClientMissingProvider,
#[error("cannot build IMAP client")]
JoinClientError(#[source] JoinError),
#[error("cannot build IMAP client")]
Expand Down
Loading

0 comments on commit 6b981f1

Please sign in to comment.