diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 47ae586d0..95090ddc6 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -3603,6 +3603,7 @@ pub unsafe extern "C" fn dc_provider_get_status(provider: *const dc_provider_t) } #[no_mangle] +#[allow(clippy::needless_return)] pub unsafe extern "C" fn dc_provider_unref(provider: *mut dc_provider_t) { if provider.is_null() { eprintln!("ignoring careless call to dc_provider_unref()"); diff --git a/src/configure/auto_mozilla.rs b/src/configure/auto_mozilla.rs index 9b96d208b..9601fbeff 100644 --- a/src/configure/auto_mozilla.rs +++ b/src/configure/auto_mozilla.rs @@ -115,8 +115,8 @@ fn parse_server( MozConfigTag::Username => username = Some(val), MozConfigTag::Sockettype => { sockettype = match val.to_lowercase().as_ref() { - "ssl" => Socket::SSL, - "starttls" => Socket::STARTTLS, + "ssl" => Socket::Ssl, + "starttls" => Socket::Starttls, "plain" => Socket::Plain, _ => Socket::Automatic, } @@ -233,8 +233,8 @@ fn parse_serverparams(in_emailaddr: &str, xml_raw: &str) -> Result Some(Protocol::IMAP), - "smtp" => Some(Protocol::SMTP), + "imap" => Some(Protocol::Imap), + "smtp" => Some(Protocol::Smtp), _ => None, }; Some(ServerParams { @@ -276,10 +276,10 @@ mod tests { fn test_parse_outlook_autoconfig() { let xml_raw = include_str!("../../test-data/autoconfig/outlook.com.xml"); let res = parse_serverparams("example@outlook.com", xml_raw).expect("XML parsing failed"); - assert_eq!(res[0].protocol, Protocol::IMAP); + assert_eq!(res[0].protocol, Protocol::Imap); assert_eq!(res[0].hostname, "outlook.office365.com"); assert_eq!(res[0].port, 993); - assert_eq!(res[1].protocol, Protocol::SMTP); + assert_eq!(res[1].protocol, Protocol::Smtp); assert_eq!(res[1].hostname, "smtp.office365.com"); assert_eq!(res[1].port, 587); } @@ -295,25 +295,25 @@ mod tests { assert_eq!(res.incoming_servers[0].typ, "imap"); assert_eq!(res.incoming_servers[0].hostname, "mail.lakenet.ch"); assert_eq!(res.incoming_servers[0].port, 993); - assert_eq!(res.incoming_servers[0].sockettype, Socket::SSL); + assert_eq!(res.incoming_servers[0].sockettype, Socket::Ssl); assert_eq!(res.incoming_servers[0].username, "example@lakenet.ch"); assert_eq!(res.incoming_servers[1].typ, "imap"); assert_eq!(res.incoming_servers[1].hostname, "mail.lakenet.ch"); assert_eq!(res.incoming_servers[1].port, 143); - assert_eq!(res.incoming_servers[1].sockettype, Socket::STARTTLS); + assert_eq!(res.incoming_servers[1].sockettype, Socket::Starttls); assert_eq!(res.incoming_servers[1].username, "example@lakenet.ch"); assert_eq!(res.incoming_servers[2].typ, "pop3"); assert_eq!(res.incoming_servers[2].hostname, "mail.lakenet.ch"); assert_eq!(res.incoming_servers[2].port, 995); - assert_eq!(res.incoming_servers[2].sockettype, Socket::SSL); + assert_eq!(res.incoming_servers[2].sockettype, Socket::Ssl); assert_eq!(res.incoming_servers[2].username, "example@lakenet.ch"); assert_eq!(res.incoming_servers[3].typ, "pop3"); assert_eq!(res.incoming_servers[3].hostname, "mail.lakenet.ch"); assert_eq!(res.incoming_servers[3].port, 110); - assert_eq!(res.incoming_servers[3].sockettype, Socket::STARTTLS); + assert_eq!(res.incoming_servers[3].sockettype, Socket::Starttls); assert_eq!(res.incoming_servers[3].username, "example@lakenet.ch"); assert_eq!(res.outgoing_servers.len(), 1); @@ -321,7 +321,7 @@ mod tests { assert_eq!(res.outgoing_servers[0].typ, "smtp"); assert_eq!(res.outgoing_servers[0].hostname, "mail.lakenet.ch"); assert_eq!(res.outgoing_servers[0].port, 587); - assert_eq!(res.outgoing_servers[0].sockettype, Socket::STARTTLS); + assert_eq!(res.outgoing_servers[0].sockettype, Socket::Starttls); assert_eq!(res.outgoing_servers[0].username, "example@lakenet.ch"); } } diff --git a/src/configure/auto_outlook.rs b/src/configure/auto_outlook.rs index 92a761554..9558ac5b8 100644 --- a/src/configure/auto_outlook.rs +++ b/src/configure/auto_outlook.rs @@ -169,8 +169,8 @@ fn protocols_to_serverparams(protocols: Vec) -> Vec { .filter_map(|protocol| { Some(ServerParams { protocol: match protocol.typ.to_lowercase().as_ref() { - "imap" => Some(Protocol::IMAP), - "smtp" => Some(Protocol::SMTP), + "imap" => Some(Protocol::Imap), + "smtp" => Some(Protocol::Smtp), _ => None, }?, socket: match protocol.ssl { diff --git a/src/configure/mod.rs b/src/configure/mod.rs index 06d8cbe00..e8eaf9224 100644 --- a/src/configure/mod.rs +++ b/src/configure/mod.rs @@ -220,7 +220,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { if let Some(provider) = provider::get_provider_info(¶m_domain).await { param.provider = Some(provider); match provider.status { - provider::Status::OK | provider::Status::PREPARATION => { + provider::Status::Ok | provider::Status::Preparation => { if provider.server.is_empty() { info!(ctx, "offline autoconfig found, but no servers defined"); param_autoconfig = None; @@ -235,8 +235,8 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { hostname: s.hostname.to_string(), port: s.port, username: match s.username_pattern { - UsernamePattern::EMAIL => param.addr.to_string(), - UsernamePattern::EMAILLOCALPART => { + UsernamePattern::Email => param.addr.to_string(), + UsernamePattern::Emaillocalpart => { if let Some(at) = param.addr.find('@') { param.addr.split_at(at).0.to_string() } else { @@ -250,7 +250,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { param_autoconfig = Some(servers) } } - provider::Status::BROKEN => { + provider::Status::Broken => { info!(ctx, "offline autoconfig found, provider is broken"); param_autoconfig = None; } @@ -269,10 +269,10 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { let mut servers = param_autoconfig.unwrap_or_default(); if !servers .iter() - .any(|server| server.protocol == Protocol::IMAP) + .any(|server| server.protocol == Protocol::Imap) { servers.push(ServerParams { - protocol: Protocol::IMAP, + protocol: Protocol::Imap, hostname: param.imap.server.clone(), port: param.imap.port, socket: param.imap.security, @@ -281,10 +281,10 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { } if !servers .iter() - .any(|server| server.protocol == Protocol::SMTP) + .any(|server| server.protocol == Protocol::Smtp) { servers.push(ServerParams { - protocol: Protocol::SMTP, + protocol: Protocol::Smtp, hostname: param.smtp.server.clone(), port: param.smtp.port, socket: param.smtp.security, @@ -303,7 +303,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { let smtp_addr = param.addr.clone(); let smtp_servers: Vec = servers .iter() - .filter(|params| params.protocol == Protocol::SMTP) + .filter(|params| params.protocol == Protocol::Smtp) .cloned() .collect(); let provider_strict_tls = param.provider.map_or(false, |provider| provider.strict_tls); @@ -351,7 +351,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { let mut imap_configured = false; let imap_servers: Vec<&ServerParams> = servers .iter() - .filter(|params| params.protocol == Protocol::IMAP) + .filter(|params| params.protocol == Protocol::Imap) .collect(); let imap_servers_count = imap_servers.len(); let mut errors = Vec::new(); diff --git a/src/configure/server_params.rs b/src/configure/server_params.rs index df577de60..09355e6bc 100644 --- a/src/configure/server_params.rs +++ b/src/configure/server_params.rs @@ -49,8 +49,8 @@ impl ServerParams { res.push(self.clone()); self.hostname = match self.protocol { - Protocol::IMAP => "imap.".to_string() + param_domain, - Protocol::SMTP => "smtp.".to_string() + param_domain, + Protocol::Imap => "imap.".to_string() + param_domain, + Protocol::Smtp => "smtp.".to_string() + param_domain, }; res.push(self.clone()); @@ -66,13 +66,13 @@ impl ServerParams { // Try to infer port from socket security. if self.port == 0 { self.port = match self.socket { - Socket::SSL => match self.protocol { - Protocol::IMAP => 993, - Protocol::SMTP => 465, + Socket::Ssl => match self.protocol { + Protocol::Imap => 993, + Protocol::Smtp => 465, }, - Socket::STARTTLS | Socket::Plain => match self.protocol { - Protocol::IMAP => 143, - Protocol::SMTP => 587, + Socket::Starttls | Socket::Plain => match self.protocol { + Protocol::Imap => 143, + Protocol::Smtp => 587, }, Socket::Automatic => 0, } @@ -85,27 +85,27 @@ impl ServerParams { // Try common secure combinations. // Try STARTTLS - self.socket = Socket::STARTTLS; + self.socket = Socket::Starttls; self.port = match self.protocol { - Protocol::IMAP => 143, - Protocol::SMTP => 587, + Protocol::Imap => 143, + Protocol::Smtp => 587, }; res.push(self.clone()); // Try TLS - self.socket = Socket::SSL; + self.socket = Socket::Ssl; self.port = match self.protocol { - Protocol::IMAP => 993, - Protocol::SMTP => 465, + Protocol::Imap => 993, + Protocol::Smtp => 465, }; res.push(self); } else if self.socket == Socket::Automatic { // Try TLS over user-provided port. - self.socket = Socket::SSL; + self.socket = Socket::Ssl; res.push(self.clone()); // Try STARTTLS over user-provided port. - self.socket = Socket::STARTTLS; + self.socket = Socket::Starttls; res.push(self); } else { res.push(self); @@ -140,10 +140,10 @@ mod tests { fn test_expand_param_vector() { let v = expand_param_vector( vec![ServerParams { - protocol: Protocol::IMAP, + protocol: Protocol::Imap, hostname: "example.net".to_string(), port: 0, - socket: Socket::SSL, + socket: Socket::Ssl, username: "foobar".to_string(), }], "foobar@example.net", @@ -153,10 +153,10 @@ mod tests { assert_eq!( v, vec![ServerParams { - protocol: Protocol::IMAP, + protocol: Protocol::Imap, hostname: "example.net".to_string(), port: 993, - socket: Socket::SSL, + socket: Socket::Ssl, username: "foobar".to_string(), }], ); diff --git a/src/context.rs b/src/context.rs index 5bd0026e6..611c798e6 100644 --- a/src/context.rs +++ b/src/context.rs @@ -873,7 +873,8 @@ mod tests { { assert!( info.contains_key(&*key), - format!("'{}' missing in get_info() output", key) + "'{}' missing in get_info() output", + key ); } } diff --git a/src/e2ee.rs b/src/e2ee.rs index 5db3bbf41..5257a4358 100644 --- a/src/e2ee.rs +++ b/src/e2ee.rs @@ -544,9 +544,7 @@ Sent with my Delta Chat Messenger: https://delta.chat"; to_save: Some(ToSave::All), fingerprint_changed: false, }; - let mut peerstates = Vec::new(); - peerstates.push((Some(peerstate), addr)); - peerstates + vec![(Some(peerstate), addr)] } #[async_std::test] @@ -571,8 +569,7 @@ Sent with my Delta Chat Messenger: https://delta.chat"; assert!(encrypt_helper.should_encrypt(&t, false, &ps).unwrap()); // test with missing peerstate - let mut ps = Vec::new(); - ps.push((None, "bob@foo.bar")); + let ps = vec![(None, "bob@foo.bar")]; assert!(encrypt_helper.should_encrypt(&t, true, &ps).is_err()); assert!(!encrypt_helper.should_encrypt(&t, false, &ps).unwrap()); } diff --git a/src/ephemeral.rs b/src/ephemeral.rs index d5e35b0bc..cf48fbac7 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -775,13 +775,13 @@ mod tests { if let Ok(msg) = Message::load_from_db(t, msg_id).await { assert_eq!(msg.from_id, 0); assert_eq!(msg.to_id, 0); - assert!(msg.text.is_none_or_empty(), msg.text); + assert!(msg.text.is_none_or_empty(), "{:?}", msg.text); let rawtxt: Option = t .sql .query_get_value(sqlx::query("SELECT txt_raw FROM msgs WHERE id=?;").bind(msg_id)) .await .unwrap(); - assert!(rawtxt.is_none_or_empty(), rawtxt); + assert!(rawtxt.is_none_or_empty(), "{:?}", rawtxt); } } } diff --git a/src/imap/mod.rs b/src/imap/mod.rs index d9a429b8f..2ffc0e913 100644 --- a/src/imap/mod.rs +++ b/src/imap/mod.rs @@ -194,7 +194,7 @@ impl Imap { let oauth2 = self.config.oauth2; - let connection_res: ImapResult = if self.config.lp.security == Socket::STARTTLS + let connection_res: ImapResult = if self.config.lp.security == Socket::Starttls || self.config.lp.security == Socket::Plain { let config = &mut self.config; @@ -203,7 +203,7 @@ impl Imap { match Client::connect_insecure((imap_server, imap_port)).await { Ok(client) => { - if config.lp.security == Socket::STARTTLS { + if config.lp.security == Socket::Starttls { client.secure(imap_server, config.strict_tls).await } else { Ok(client) diff --git a/src/message.rs b/src/message.rs index dda736660..9b971e977 100644 --- a/src/message.rs +++ b/src/message.rs @@ -632,11 +632,9 @@ impl Message { // - We can't make a param `SenderDisplayname` for messages as sometimes the display name of a contact changes, and we want to show // the same display name over all messages from the same sender. pub fn get_override_sender_name(&self) -> Option { - if let Some(name) = self.param.get(Param::OverrideSenderDisplayname) { - Some(name.to_string()) - } else { - None - } + self.param + .get(Param::OverrideSenderDisplayname) + .map(|name| name.to_string()) } // Exposing this function over the ffi instead of get_override_sender_name() would mean that at least Android Java code has diff --git a/src/mimefactory.rs b/src/mimefactory.rs index b2fba251d..eb05cdba1 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -39,7 +39,7 @@ const UPPER_LIMIT_FILE_SIZE: u64 = 49 * 1024 * 1024 / 4 * 3; #[derive(Debug, Clone)] pub enum Loaded { Message { chat: Chat }, - MDN { additional_msg_ids: Vec }, + Mdn { additional_msg_ids: Vec }, } /// Helper to construct mime messages. @@ -207,7 +207,7 @@ impl<'a> MimeFactory<'a> { contact.get_addr().to_string(), )], timestamp, - loaded: Loaded::MDN { additional_msg_ids }, + loaded: Loaded::Mdn { additional_msg_ids }, msg, in_reply_to: String::default(), references: String::default(), @@ -258,7 +258,7 @@ impl<'a> MimeFactory<'a> { .get_bool(Param::GuaranteeE2ee) .unwrap_or_default() } - Loaded::MDN { .. } => false, + Loaded::Mdn { .. } => false, } } @@ -271,7 +271,7 @@ impl<'a> MimeFactory<'a> { PeerstateVerifiedStatus::Unverified } } - Loaded::MDN { .. } => PeerstateVerifiedStatus::Unverified, + Loaded::Mdn { .. } => PeerstateVerifiedStatus::Unverified, } } @@ -287,7 +287,7 @@ impl<'a> MimeFactory<'a> { .unwrap_or_default() } } - Loaded::MDN { .. } => true, + Loaded::Mdn { .. } => true, } } @@ -298,7 +298,7 @@ impl<'a> MimeFactory<'a> { .param .get_bool(Param::SkipAutocrypt) .unwrap_or_default(), - Loaded::MDN { .. } => true, + Loaded::Mdn { .. } => true, } } @@ -313,7 +313,7 @@ impl<'a> MimeFactory<'a> { Ok(self.msg.param.get_cmd() == SystemMessage::MemberAddedToGroup) } } - Loaded::MDN { .. } => Ok(false), + Loaded::Mdn { .. } => Ok(false), } } @@ -343,7 +343,7 @@ impl<'a> MimeFactory<'a> { None } - Loaded::MDN { .. } => None, + Loaded::Mdn { .. } => None, } } @@ -388,7 +388,7 @@ impl<'a> MimeFactory<'a> { stock_str::subject_for_new_contact(context, self_name).await } } - Loaded::MDN { .. } => stock_str::read_rcpt(context).await, + Loaded::Mdn { .. } => stock_str::read_rcpt(context).await, }; Ok(subject) @@ -451,7 +451,7 @@ impl<'a> MimeFactory<'a> { unprotected_headers.push(Header::new("Chat-Version".to_string(), "1.0".to_string())); - if let Loaded::MDN { .. } = self.loaded { + if let Loaded::Mdn { .. } = self.loaded { unprotected_headers.push(Header::new( "Auto-Submitted".to_string(), "auto-replied".to_string(), @@ -497,7 +497,7 @@ impl<'a> MimeFactory<'a> { let rfc724_mid = match self.loaded { Loaded::Message { .. } => self.msg.rfc724_mid.clone(), - Loaded::MDN { .. } => dc_create_outgoing_rfc724_mid(None, &self.from_addr), + Loaded::Mdn { .. } => dc_create_outgoing_rfc724_mid(None, &self.from_addr), }; let ephemeral_timer = self.msg.chat_id.get_ephemeral_timer(context).await?; @@ -534,7 +534,7 @@ impl<'a> MimeFactory<'a> { ) .await? } - Loaded::MDN { .. } => (self.render_mdn(context).await?, Vec::new()), + Loaded::Mdn { .. } => (self.render_mdn(context).await?, Vec::new()), }; let peerstates = self.peerstates_for_recipients(context).await?; @@ -704,7 +704,7 @@ impl<'a> MimeFactory<'a> { ) -> Result<(PartBuilder, Vec), Error> { let chat = match &self.loaded { Loaded::Message { chat } => chat, - Loaded::MDN { .. } => bail!("Attempt to render MDN as a message"), + Loaded::Mdn { .. } => bail!("Attempt to render MDN as a message"), }; let command = self.msg.param.get_cmd(); let mut placeholdertext = None; @@ -1037,7 +1037,7 @@ impl<'a> MimeFactory<'a> { let additional_msg_ids = match &self.loaded { Loaded::Message { .. } => bail!("Attempt to render a message as MDN"), - Loaded::MDN { + Loaded::Mdn { additional_msg_ids, .. } => additional_msg_ids, }; diff --git a/src/provider/data.rs b/src/provider/data.rs index cca0bf6f0..347a6cd0c 100644 --- a/src/provider/data.rs +++ b/src/provider/data.rs @@ -11,24 +11,24 @@ use once_cell::sync::Lazy; // aktivix.org.md: aktivix.org static P_AKTIVIX_ORG: Lazy = Lazy::new(|| Provider { id: "aktivix.org", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/aktivix-org", server: vec![ Server { - protocol: IMAP, - socket: STARTTLS, + protocol: Imap, + socket: Starttls, hostname: "newyear.aktivix.org", port: 143, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "newyear.aktivix.org", port: 25, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -41,13 +41,13 @@ static P_AKTIVIX_ORG: Lazy = Lazy::new(|| Provider { static P_AOL: Lazy = Lazy::new(|| { Provider { id: "aol", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "To log in to AOL with Delta Chat, you need to set up an app password in the AOL web interface.", after_login_hint: "", overview_page: "https://providers.delta.chat/aol", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "imap.aol.com", port: 993, username_pattern: EMAIL }, - Server { protocol: SMTP, socket: SSL, hostname: "smtp.aol.com", port: 465, username_pattern: EMAIL }, + Server { protocol: Imap, socket: Ssl, hostname: "imap.aol.com", port: 993, username_pattern: Email }, + Server { protocol: Smtp, socket: Ssl, hostname: "smtp.aol.com", port: 465, username_pattern: Email }, ], config_defaults: None, strict_tls: true, @@ -59,24 +59,24 @@ static P_AOL: Lazy = Lazy::new(|| { // arcor.de.md: arcor.de static P_ARCOR_DE: Lazy = Lazy::new(|| Provider { id: "arcor.de", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/arcor-de", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.arcor.de", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "mail.arcor.de", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -88,24 +88,24 @@ static P_ARCOR_DE: Lazy = Lazy::new(|| Provider { // autistici.org.md: autistici.org static P_AUTISTICI_ORG: Lazy = Lazy::new(|| Provider { id: "autistici.org", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/autistici-org", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "mail.autistici.org", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "smtp.autistici.org", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -117,24 +117,24 @@ static P_AUTISTICI_ORG: Lazy = Lazy::new(|| Provider { // bluewin.ch.md: bluewin.ch static P_BLUEWIN_CH: Lazy = Lazy::new(|| Provider { id: "bluewin.ch", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/bluewin-ch", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imaps.bluewin.ch", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "smtpauths.bluewin.ch", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -146,24 +146,24 @@ static P_BLUEWIN_CH: Lazy = Lazy::new(|| Provider { // buzon.uy.md: buzon.uy static P_BUZON_UY: Lazy = Lazy::new(|| Provider { id: "buzon.uy", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/buzon-uy", server: vec![ Server { - protocol: IMAP, - socket: STARTTLS, + protocol: Imap, + socket: Starttls, hostname: "mail.buzon.uy", port: 143, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "mail.buzon.uy", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -175,24 +175,24 @@ static P_BUZON_UY: Lazy = Lazy::new(|| Provider { // chello.at.md: chello.at static P_CHELLO_AT: Lazy = Lazy::new(|| Provider { id: "chello.at", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/chello-at", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "mail.mymagenta.at", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "mail.mymagenta.at", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -204,7 +204,7 @@ static P_CHELLO_AT: Lazy = Lazy::new(|| Provider { // comcast.md: xfinity.com, comcast.net static P_COMCAST: Lazy = Lazy::new(|| Provider { id: "comcast", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/comcast", @@ -218,7 +218,7 @@ static P_COMCAST: Lazy = Lazy::new(|| Provider { // dismail.de.md: dismail.de static P_DISMAIL_DE: Lazy = Lazy::new(|| Provider { id: "dismail.de", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/dismail-de", @@ -232,7 +232,7 @@ static P_DISMAIL_DE: Lazy = Lazy::new(|| Provider { // disroot.md: disroot.org static P_DISROOT: Lazy = Lazy::new(|| Provider { id: "disroot", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/disroot", @@ -246,31 +246,31 @@ static P_DISROOT: Lazy = Lazy::new(|| Provider { // dubby.org.md: dubby.org static P_DUBBY_ORG: Lazy = Lazy::new(|| Provider { id: "dubby.org", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/dubby-org", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "dubby.org", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "dubby.org", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "dubby.org", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: Some(vec![ @@ -299,24 +299,24 @@ static P_DUBBY_ORG: Lazy = Lazy::new(|| Provider { // e.email.md: e.email static P_E_EMAIL: Lazy = Lazy::new(|| Provider { id: "e.email", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/e-email", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "mail.ecloud.global", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "mail.ecloud.global", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -328,7 +328,7 @@ static P_E_EMAIL: Lazy = Lazy::new(|| Provider { // espiv.net.md: espiv.net static P_ESPIV_NET: Lazy = Lazy::new(|| Provider { id: "espiv.net", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/espiv-net", @@ -343,13 +343,13 @@ static P_ESPIV_NET: Lazy = Lazy::new(|| Provider { static P_EXAMPLE_COM: Lazy = Lazy::new(|| { Provider { id: "example.com", - status: Status::BROKEN, + status: Status::Broken, before_login_hint: "Hush this provider doesn't exist!", after_login_hint: "This provider doesn't really exist, so you can't use it :/ If you need an email provider for Delta Chat, take a look at providers.delta.chat!", overview_page: "https://providers.delta.chat/example-com", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "imap.example.com", port: 1337, username_pattern: EMAIL }, - Server { protocol: SMTP, socket: STARTTLS, hostname: "smtp.example.com", port: 1337, username_pattern: EMAIL }, + Server { protocol: Imap, socket: Ssl, hostname: "imap.example.com", port: 1337, username_pattern: Email }, + Server { protocol: Smtp, socket: Starttls, hostname: "smtp.example.com", port: 1337, username_pattern: Email }, ], config_defaults: None, strict_tls: true, @@ -361,32 +361,32 @@ static P_EXAMPLE_COM: Lazy = Lazy::new(|| { // fastmail.md: fastmail.com static P_FASTMAIL: Lazy = Lazy::new(|| Provider { id: "fastmail", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "You must create an app-specific password for Delta Chat before you can log in.", after_login_hint: "", overview_page: "https://providers.delta.chat/fastmail", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.fastmail.com", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "smtp.fastmail.com", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "smtp.fastmail.com", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -399,7 +399,7 @@ static P_FASTMAIL: Lazy = Lazy::new(|| Provider { static P_FIREMAIL_DE: Lazy = Lazy::new(|| { Provider { id: "firemail.de", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "Firemail erlaubt nur bei bezahlten Accounts den vollen Zugriff auf das E-Mail-Protokoll. Wenn Sie nicht für Firemail bezahlen, verwenden Sie bitte einen anderen E-Mail-Anbieter.", after_login_hint: "Leider schränkt Firemail die maximale Gruppengröße ein. Je nach Bezahlmodell sind nur 5 bis 30 Gruppenmitglieder erlaubt.", overview_page: "https://providers.delta.chat/firemail-de", @@ -415,7 +415,7 @@ static P_FIREMAIL_DE: Lazy = Lazy::new(|| { // five.chat.md: five.chat static P_FIVE_CHAT: Lazy = Lazy::new(|| Provider { id: "five.chat", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/five-chat", @@ -447,13 +447,13 @@ static P_FIVE_CHAT: Lazy = Lazy::new(|| Provider { static P_FREENET_DE: Lazy = Lazy::new(|| { Provider { id: "freenet.de", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "Um deine freenet.de E-Mail-Adresse mit Delta Chat zu benutzen, musst du erst auf der freenet.de-Webseite \"POP3/IMAP/SMTP\" aktivieren.", after_login_hint: "", overview_page: "https://providers.delta.chat/freenet-de", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "mx.freenet.de", port: 993, username_pattern: EMAIL }, - Server { protocol: SMTP, socket: STARTTLS, hostname: "mx.freenet.de", port: 587, username_pattern: EMAIL }, + Server { protocol: Imap, socket: Ssl, hostname: "mx.freenet.de", port: 993, username_pattern: Email }, + Server { protocol: Smtp, socket: Starttls, hostname: "mx.freenet.de", port: 587, username_pattern: Email }, ], config_defaults: None, strict_tls: true, @@ -466,13 +466,13 @@ static P_FREENET_DE: Lazy = Lazy::new(|| { static P_GMAIL: Lazy = Lazy::new(|| { Provider { id: "gmail", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "For Gmail accounts, you need to create an app-password if you have \"2-Step Verification\" enabled. If this setting is not available, you need to enable \"less secure apps\".", after_login_hint: "", overview_page: "https://providers.delta.chat/gmail", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "imap.gmail.com", port: 993, username_pattern: EMAIL }, - Server { protocol: SMTP, socket: SSL, hostname: "smtp.gmail.com", port: 465, username_pattern: EMAIL }, + Server { protocol: Imap, socket: Ssl, hostname: "imap.gmail.com", port: 993, username_pattern: Email }, + Server { protocol: Smtp, socket: Ssl, hostname: "smtp.gmail.com", port: 465, username_pattern: Email }, ], config_defaults: None, strict_tls: true, @@ -484,31 +484,31 @@ static P_GMAIL: Lazy = Lazy::new(|| { // gmx.net.md: gmx.net, gmx.de, gmx.at, gmx.ch, gmx.org, gmx.eu, gmx.info, gmx.biz, gmx.com static P_GMX_NET: Lazy = Lazy::new(|| Provider { id: "gmx.net", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "You must allow IMAP access to your account before you can login.", after_login_hint: "", overview_page: "https://providers.delta.chat/gmx-net", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.gmx.net", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "mail.gmx.net", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "mail.gmx.net", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -520,7 +520,7 @@ static P_GMX_NET: Lazy = Lazy::new(|| Provider { // hermes.radio.md: hermes.radio static P_HERMES_RADIO: Lazy = Lazy::new(|| Provider { id: "hermes.radio", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/hermes-radio", @@ -552,7 +552,7 @@ static P_HERMES_RADIO: Lazy = Lazy::new(|| Provider { static P_HEY_COM: Lazy = Lazy::new(|| { Provider { id: "hey.com", - status: Status::BROKEN, + status: Status::Broken, before_login_hint: "hey.com does not offer the standard IMAP e-mail protocol, so you cannot log in with Delta Chat to hey.com.", after_login_hint: "", overview_page: "https://providers.delta.chat/hey-com", @@ -568,7 +568,7 @@ static P_HEY_COM: Lazy = Lazy::new(|| { // i.ua.md: i.ua static P_I_UA: Lazy = Lazy::new(|| Provider { id: "i.ua", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/i-ua", @@ -582,7 +582,7 @@ static P_I_UA: Lazy = Lazy::new(|| Provider { // i3.net.md: i3.net static P_I3_NET: Lazy = Lazy::new(|| Provider { id: "i3.net", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/i3-net", @@ -596,25 +596,25 @@ static P_I3_NET: Lazy = Lazy::new(|| Provider { // icloud.md: icloud.com, me.com, mac.com static P_ICLOUD: Lazy = Lazy::new(|| Provider { id: "icloud", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "You must create an app-specific password for Delta Chat before you can login.", after_login_hint: "", overview_page: "https://providers.delta.chat/icloud", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.mail.me.com", port: 993, - username_pattern: EMAILLOCALPART, + username_pattern: Emaillocalpart, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "smtp.mail.me.com", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -626,7 +626,7 @@ static P_ICLOUD: Lazy = Lazy::new(|| Provider { // kolst.com.md: kolst.com static P_KOLST_COM: Lazy = Lazy::new(|| Provider { id: "kolst.com", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/kolst-com", @@ -640,7 +640,7 @@ static P_KOLST_COM: Lazy = Lazy::new(|| Provider { // kontent.com.md: kontent.com static P_KONTENT_COM: Lazy = Lazy::new(|| Provider { id: "kontent.com", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/kontent-com", @@ -652,23 +652,26 @@ static P_KONTENT_COM: Lazy = Lazy::new(|| Provider { }); // mail.ru.md: mail.ru, inbox.ru, bk.ru, list.ru -static P_MAIL_RU: Lazy = Lazy::new(|| Provider { +static P_MAIL_RU: Lazy = Lazy::new(|| { + Provider { id: "mail.ru", - status: Status::OK, - before_login_hint: "", + status: Status::Ok, + before_login_hint: "Не рекомендуется использовать mail.ru, потому что он разряжает вашу батарею быстрее, чем другие провайдеры.", after_login_hint: "", overview_page: "https://providers.delta.chat/mail-ru", - server: vec![], + server: vec![ + ], config_defaults: None, strict_tls: true, max_smtp_rcpt_to: None, oauth2_authorizer: None, +} }); // mailbox.org.md: mailbox.org, secure.mailbox.org static P_MAILBOX_ORG: Lazy = Lazy::new(|| Provider { id: "mailbox.org", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/mailbox-org", @@ -682,24 +685,24 @@ static P_MAILBOX_ORG: Lazy = Lazy::new(|| Provider { // mailo.com.md: mailo.com static P_MAILO_COM: Lazy = Lazy::new(|| Provider { id: "mailo.com", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/mailo-com", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.mailo.com", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "smtp.mailo.com", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -711,24 +714,24 @@ static P_MAILO_COM: Lazy = Lazy::new(|| Provider { // nauta.cu.md: nauta.cu static P_NAUTA_CU: Lazy = Lazy::new(|| Provider { id: "nauta.cu", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/nauta-cu", server: vec![ Server { - protocol: IMAP, - socket: STARTTLS, + protocol: Imap, + socket: Starttls, hostname: "imap.nauta.cu", port: 143, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "smtp.nauta.cu", port: 25, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: Some(vec![ @@ -773,24 +776,24 @@ static P_NAUTA_CU: Lazy = Lazy::new(|| Provider { // outlook.com.md: hotmail.com, outlook.com, office365.com, outlook.com.tr, live.com static P_OUTLOOK_COM: Lazy = Lazy::new(|| Provider { id: "outlook.com", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/outlook-com", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "outlook.office365.com", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "smtp.office365.com", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -802,24 +805,24 @@ static P_OUTLOOK_COM: Lazy = Lazy::new(|| Provider { // posteo.md: posteo.de, posteo.af, posteo.at, posteo.be, posteo.ch, posteo.cl, posteo.co, posteo.co.uk, posteo.com.br, posteo.cr, posteo.cz, posteo.dk, posteo.ee, posteo.es, posteo.eu, posteo.fi, posteo.gl, posteo.gr, posteo.hn, posteo.hr, posteo.hu, posteo.ie, posteo.in, posteo.is, posteo.jp, posteo.la, posteo.li, posteo.lt, posteo.lu, posteo.me, posteo.mx, posteo.my, posteo.net, posteo.nl, posteo.no, posteo.nz, posteo.org, posteo.pe, posteo.pl, posteo.pm, posteo.pt, posteo.ro, posteo.ru, posteo.se, posteo.sg, posteo.si, posteo.tn, posteo.uk, posteo.us static P_POSTEO: Lazy = Lazy::new(|| Provider { id: "posteo", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/posteo", server: vec![ Server { - protocol: IMAP, - socket: STARTTLS, + protocol: Imap, + socket: Starttls, hostname: "posteo.de", port: 143, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "posteo.de", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -832,7 +835,7 @@ static P_POSTEO: Lazy = Lazy::new(|| Provider { static P_PROTONMAIL: Lazy = Lazy::new(|| { Provider { id: "protonmail", - status: Status::BROKEN, + status: Status::Broken, before_login_hint: "Protonmail does not offer the standard IMAP e-mail protocol, so you cannot log in with Delta Chat to Protonmail.", after_login_hint: "To use Delta Chat with Protonmail, the IMAP bridge must be running in the background. If you have connectivity issues, double check whether it works as expected.", overview_page: "https://providers.delta.chat/protonmail", @@ -848,7 +851,7 @@ static P_PROTONMAIL: Lazy = Lazy::new(|| { // riseup.net.md: riseup.net static P_RISEUP_NET: Lazy = Lazy::new(|| Provider { id: "riseup.net", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/riseup-net", @@ -862,7 +865,7 @@ static P_RISEUP_NET: Lazy = Lazy::new(|| Provider { // rogers.com.md: rogers.com static P_ROGERS_COM: Lazy = Lazy::new(|| Provider { id: "rogers.com", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/rogers-com", @@ -876,7 +879,7 @@ static P_ROGERS_COM: Lazy = Lazy::new(|| Provider { // systemli.org.md: systemli.org static P_SYSTEMLI_ORG: Lazy = Lazy::new(|| Provider { id: "systemli.org", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/systemli-org", @@ -891,13 +894,13 @@ static P_SYSTEMLI_ORG: Lazy = Lazy::new(|| Provider { static P_T_ONLINE: Lazy = Lazy::new(|| { Provider { id: "t-online", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "To use Delta Chat with a T-Online email address, you need to create an app password in the web interface.", after_login_hint: "", overview_page: "https://providers.delta.chat/t-online", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "secureimap.t-online.de", port: 993, username_pattern: EMAIL }, - Server { protocol: SMTP, socket: SSL, hostname: "securesmtp.t-online.de", port: 465, username_pattern: EMAIL }, + Server { protocol: Imap, socket: Ssl, hostname: "secureimap.t-online.de", port: 993, username_pattern: Email }, + Server { protocol: Smtp, socket: Ssl, hostname: "securesmtp.t-online.de", port: 465, username_pattern: Email }, ], config_defaults: None, strict_tls: true, @@ -909,31 +912,31 @@ static P_T_ONLINE: Lazy = Lazy::new(|| { // testrun.md: testrun.org static P_TESTRUN: Lazy = Lazy::new(|| Provider { id: "testrun", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/testrun", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "testrun.org", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: IMAP, - socket: STARTTLS, + protocol: Imap, + socket: Starttls, hostname: "testrun.org", port: 143, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "testrun.org", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: Some(vec![ @@ -962,24 +965,24 @@ static P_TESTRUN: Lazy = Lazy::new(|| Provider { // tiscali.it.md: tiscali.it static P_TISCALI_IT: Lazy = Lazy::new(|| Provider { id: "tiscali.it", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/tiscali-it", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.tiscali.it", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "smtp.tiscali.it", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -991,7 +994,7 @@ static P_TISCALI_IT: Lazy = Lazy::new(|| Provider { // ukr.net.md: ukr.net static P_UKR_NET: Lazy = Lazy::new(|| Provider { id: "ukr.net", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/ukr-net", @@ -1005,24 +1008,24 @@ static P_UKR_NET: Lazy = Lazy::new(|| Provider { // undernet.uy.md: undernet.uy static P_UNDERNET_UY: Lazy = Lazy::new(|| Provider { id: "undernet.uy", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/undernet-uy", server: vec![ Server { - protocol: IMAP, - socket: STARTTLS, + protocol: Imap, + socket: Starttls, hostname: "undernet.uy", port: 143, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "undernet.uy", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -1034,7 +1037,7 @@ static P_UNDERNET_UY: Lazy = Lazy::new(|| Provider { // vfemail.md: vfemail.net static P_VFEMAIL: Lazy = Lazy::new(|| Provider { id: "vfemail", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/vfemail", @@ -1048,24 +1051,24 @@ static P_VFEMAIL: Lazy = Lazy::new(|| Provider { // vodafone.de.md: vodafone.de, vodafonemail.de static P_VODAFONE_DE: Lazy = Lazy::new(|| Provider { id: "vodafone.de", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/vodafone-de", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.vodafonemail.de", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "smtp.vodafonemail.de", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -1078,14 +1081,14 @@ static P_VODAFONE_DE: Lazy = Lazy::new(|| Provider { static P_WEB_DE: Lazy = Lazy::new(|| { Provider { id: "web.de", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "You must allow IMAP access to your account before you can login.", after_login_hint: "Note: if you have your web.de spam settings too strict, you won't receive contact requests from new people. If you want to receive contact requests, you should disable the \"3-Wege-Spamschutz\" in the web.de settings. Read how: https://hilfe.web.de/email/spam-und-viren/spamschutz-einstellungen.html", overview_page: "https://providers.delta.chat/web-de", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "imap.web.de", port: 993, username_pattern: EMAILLOCALPART }, - Server { protocol: IMAP, socket: STARTTLS, hostname: "imap.web.de", port: 143, username_pattern: EMAILLOCALPART }, - Server { protocol: SMTP, socket: STARTTLS, hostname: "smtp.web.de", port: 587, username_pattern: EMAILLOCALPART }, + Server { protocol: Imap, socket: Ssl, hostname: "imap.web.de", port: 993, username_pattern: Emaillocalpart }, + Server { protocol: Imap, socket: Starttls, hostname: "imap.web.de", port: 143, username_pattern: Emaillocalpart }, + Server { protocol: Smtp, socket: Starttls, hostname: "smtp.web.de", port: 587, username_pattern: Emaillocalpart }, ], config_defaults: None, strict_tls: true, @@ -1098,13 +1101,13 @@ static P_WEB_DE: Lazy = Lazy::new(|| { static P_YAHOO: Lazy = Lazy::new(|| { Provider { id: "yahoo", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "To use Delta Chat with your Yahoo email address you have to create an \"App-Password\" in the account security screen.", after_login_hint: "", overview_page: "https://providers.delta.chat/yahoo", server: vec![ - Server { protocol: IMAP, socket: SSL, hostname: "imap.mail.yahoo.com", port: 993, username_pattern: EMAIL }, - Server { protocol: SMTP, socket: SSL, hostname: "smtp.mail.yahoo.com", port: 465, username_pattern: EMAIL }, + Server { protocol: Imap, socket: Ssl, hostname: "imap.mail.yahoo.com", port: 993, username_pattern: Email }, + Server { protocol: Smtp, socket: Ssl, hostname: "smtp.mail.yahoo.com", port: 465, username_pattern: Email }, ], config_defaults: None, strict_tls: true, @@ -1116,24 +1119,24 @@ static P_YAHOO: Lazy = Lazy::new(|| { // yandex.ru.md: yandex.com, yandex.by, yandex.kz, yandex.ru, yandex.ua, ya.ru, narod.ru static P_YANDEX_RU: Lazy = Lazy::new(|| Provider { id: "yandex.ru", - status: Status::PREPARATION, + status: Status::Preparation, before_login_hint: "For Yandex accounts, you have to set IMAP protocol option turned on.", after_login_hint: "", overview_page: "https://providers.delta.chat/yandex-ru", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.yandex.com", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: SSL, + protocol: Smtp, + socket: Ssl, hostname: "smtp.yandex.com", port: 465, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -1145,24 +1148,24 @@ static P_YANDEX_RU: Lazy = Lazy::new(|| Provider { // ziggo.nl.md: ziggo.nl static P_ZIGGO_NL: Lazy = Lazy::new(|| Provider { id: "ziggo.nl", - status: Status::OK, + status: Status::Ok, before_login_hint: "", after_login_hint: "", overview_page: "https://providers.delta.chat/ziggo-nl", server: vec![ Server { - protocol: IMAP, - socket: SSL, + protocol: Imap, + socket: Ssl, hostname: "imap.ziggo.nl", port: 993, - username_pattern: EMAIL, + username_pattern: Email, }, Server { - protocol: SMTP, - socket: STARTTLS, + protocol: Smtp, + socket: Starttls, hostname: "smtp.ziggo.nl", port: 587, - username_pattern: EMAIL, + username_pattern: Email, }, ], config_defaults: None, @@ -1405,4 +1408,4 @@ pub(crate) static PROVIDER_IDS: Lazy> = }); pub static PROVIDER_UPDATED: Lazy = - Lazy::new(|| chrono::NaiveDate::from_ymd(2021, 3, 18)); + Lazy::new(|| chrono::NaiveDate::from_ymd(2021, 4, 10)); diff --git a/src/provider/mod.rs b/src/provider/mod.rs index e0e8d1b90..d2b8ac6a5 100644 --- a/src/provider/mod.rs +++ b/src/provider/mod.rs @@ -10,24 +10,24 @@ use chrono::{NaiveDateTime, NaiveTime}; #[derive(Debug, Display, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)] #[repr(u8)] pub enum Status { - OK = 1, - PREPARATION = 2, - BROKEN = 3, + Ok = 1, + Preparation = 2, + Broken = 3, } #[derive(Debug, Display, PartialEq, Copy, Clone, FromPrimitive, ToPrimitive)] #[repr(u8)] pub enum Protocol { - SMTP = 1, - IMAP = 2, + Smtp = 1, + Imap = 2, } #[derive(Debug, Display, PartialEq, Copy, Clone, FromPrimitive, ToPrimitive)] #[repr(u8)] pub enum Socket { Automatic = 0, - SSL = 1, - STARTTLS = 2, + Ssl = 1, + Starttls = 2, Plain = 3, } @@ -40,8 +40,8 @@ impl Default for Socket { #[derive(Debug, PartialEq, Clone)] #[repr(u8)] pub enum UsernamePattern { - EMAIL = 1, - EMAILLOCALPART = 2, + Email = 1, + Emaillocalpart = 2, } #[derive(Debug, PartialEq)] @@ -151,6 +151,8 @@ pub async fn get_provider_by_mx(domain: impl AsRef) -> Option<&'static Prov None } +// TODO: uncomment when clippy starts complaining about it +//#[allow(clippy::manual_map)] // Can't use .map() because the lifetime is not propagated pub fn get_provider_by_id(id: &str) -> Option<&'static Provider> { if let Some(provider) = PROVIDER_IDS.get(id) { Some(provider) @@ -181,34 +183,34 @@ mod tests { #[test] fn test_get_provider_by_domain_mixed_case() { let provider = get_provider_by_domain("nAUta.Cu").unwrap(); - assert!(provider.status == Status::OK); + assert!(provider.status == Status::Ok); } #[test] fn test_get_provider_by_domain() { let addr = "nauta.cu"; let provider = get_provider_by_domain(addr).unwrap(); - assert!(provider.status == Status::OK); + assert!(provider.status == Status::Ok); let server = &provider.server[0]; - assert_eq!(server.protocol, Protocol::IMAP); - assert_eq!(server.socket, Socket::STARTTLS); + assert_eq!(server.protocol, Protocol::Imap); + assert_eq!(server.socket, Socket::Starttls); assert_eq!(server.hostname, "imap.nauta.cu"); assert_eq!(server.port, 143); - assert_eq!(server.username_pattern, UsernamePattern::EMAIL); + assert_eq!(server.username_pattern, UsernamePattern::Email); let server = &provider.server[1]; - assert_eq!(server.protocol, Protocol::SMTP); - assert_eq!(server.socket, Socket::STARTTLS); + assert_eq!(server.protocol, Protocol::Smtp); + assert_eq!(server.socket, Socket::Starttls); assert_eq!(server.hostname, "smtp.nauta.cu"); assert_eq!(server.port, 25); - assert_eq!(server.username_pattern, UsernamePattern::EMAIL); + assert_eq!(server.username_pattern, UsernamePattern::Email); let provider = get_provider_by_domain("gmail.com").unwrap(); - assert!(provider.status == Status::PREPARATION); + assert!(provider.status == Status::Preparation); assert!(!provider.before_login_hint.is_empty()); assert!(!provider.overview_page.is_empty()); let provider = get_provider_by_domain("googlemail.com").unwrap(); - assert!(provider.status == Status::PREPARATION); + assert!(provider.status == Status::Preparation); } #[test] diff --git a/src/provider/update.py b/src/provider/update.py index b6e514bf4..a9ecbf146 100755 --- a/src/provider/update.py +++ b/src/provider/update.py @@ -103,8 +103,8 @@ def process_data(data, file): if username_pattern != "EMAIL" and username_pattern != "EMAILLOCALPART": raise TypeError("bad username pattern") - server += (" Server { protocol: " + protocol + ", socket: " + socket + ", hostname: \"" - + hostname + "\", port: " + str(port) + ", username_pattern: " + username_pattern + " },\n") + server += (" Server { protocol: " + protocol.capitalize() + ", socket: " + socket.capitalize() + ", hostname: \"" + + hostname + "\", port: " + str(port) + ", username_pattern: " + username_pattern.capitalize() + " },\n") config_defaults = process_config_defaults(data) @@ -123,7 +123,7 @@ def process_data(data, file): if (not has_imap and not has_smtp) or (has_imap and has_smtp): provider += "static " + file2varname(file) + ": Lazy = Lazy::new(|| Provider {\n" provider += " id: \"" + file2id(file) + "\",\n" - provider += " status: Status::" + status + ",\n" + provider += " status: Status::" + status.capitalize() + ",\n" provider += " before_login_hint: \"" + before_login_hint + "\",\n" provider += " after_login_hint: \"" + after_login_hint + "\",\n" provider += " overview_page: \"" + file2url(file) + "\",\n" diff --git a/src/qr.rs b/src/qr.rs index 8bb6a5f8d..6952086ca 100644 --- a/src/qr.rs +++ b/src/qr.rs @@ -27,11 +27,11 @@ const HTTP_SCHEME: &str = "http://"; const HTTPS_SCHEME: &str = "https://"; // Make it easy to convert errors into the final `Lot`. -impl Into for Error { - fn into(self) -> Lot { - let mut l = Lot::new(); +impl From for Lot { + fn from(error: Error) -> Self { + let mut l = Self::new(); l.state = LotState::QrError; - l.text1 = Some(self.to_string()); + l.text1 = Some(error.to_string()); l } diff --git a/src/scheduler.rs b/src/scheduler.rs index a14f8ed71..cd87669f4 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -553,9 +553,9 @@ impl SmtpConnectionState { }; let state = ConnectionState { - idle_interrupt_sender, shutdown_receiver, stop_sender, + idle_interrupt_sender, }; let conn = SmtpConnectionState { state }; @@ -600,9 +600,9 @@ impl ImapConnectionState { }; let state = ConnectionState { - idle_interrupt_sender, shutdown_receiver, stop_sender, + idle_interrupt_sender, }; let conn = ImapConnectionState { state }; diff --git a/src/securejoin/bobstate.rs b/src/securejoin/bobstate.rs index 2388b9c6a..48bc6308f 100644 --- a/src/securejoin/bobstate.rs +++ b/src/securejoin/bobstate.rs @@ -60,14 +60,11 @@ pub struct BobStateHandle<'a> { impl<'a> BobStateHandle<'a> { /// Creates a new instance, upholding the guarantee that [`BobState`] must exist. pub fn from_guard(mut guard: MutexGuard<'a, Option>) -> Option { - match guard.take() { - Some(bobstate) => Some(Self { - guard, - bobstate, - clear_state_on_drop: false, - }), - None => None, - } + guard.take().map(|bobstate| Self { + guard, + bobstate, + clear_state_on_drop: false, + }) } /// Returns the [`ChatId`] of the 1:1 chat with the inviter (Alice). diff --git a/src/smtp/mod.rs b/src/smtp/mod.rs index 774ce4a7c..6e178296f 100644 --- a/src/smtp/mod.rs +++ b/src/smtp/mod.rs @@ -192,7 +192,7 @@ impl Smtp { let security = match lp.security { Socket::Plain => smtp::ClientSecurity::None, - Socket::STARTTLS => smtp::ClientSecurity::Required(tls_parameters), + Socket::Starttls => smtp::ClientSecurity::Required(tls_parameters), _ => smtp::ClientSecurity::Wrapper(tls_parameters), }; diff --git a/src/sql/mod.rs b/src/sql/mod.rs index 52ea0ff6f..93a79ab51 100644 --- a/src/sql/mod.rs +++ b/src/sql/mod.rs @@ -804,7 +804,7 @@ mod test { "File {} was almost deleted, only reason it was kept is that it was created recently (as the tests don't run for a long time)", s ), - EventType::Error(s) => panic!(s), + EventType::Error(s) => panic!("{}", s), _ => {} } }) diff --git a/src/test_utils.rs b/src/test_utils.rs index 8af5058ec..e44e9e1c0 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -500,7 +500,7 @@ impl Drop for TestContext { fn drop(&mut self) { if !thread::panicking() { if let Ok(p) = self.poison_receiver.try_recv() { - panic!(p); + panic!("{}", p); } } }