diff --git a/src/chat.rs b/src/chat.rs index fd4a2807c..928c781f1 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -2670,6 +2670,7 @@ pub(crate) async fn get_chat_id_by_grpid( /// Adds a message to device chat. /// /// Optional `label` can be provided to ensure that message is added only once. +/// If `important` is true, a notification will be sent. pub async fn add_device_msg_with_importance( context: &Context, label: Option<&str>, diff --git a/src/config.rs b/src/config.rs index 1fd6016b7..ddb266e7b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -119,7 +119,9 @@ pub enum Config { SysConfigKeys, #[strum(props(default = "0"))] - WarnedAboutWrongPw, + /// Whether we send a warning if the password is wrong (set to false when we send a warning + /// because we do not want to send a second warning) + NotifyAboutWrongPw, } impl Context { diff --git a/src/configure/mod.rs b/src/configure/mod.rs index d76e410ab..89bf858eb 100644 --- a/src/configure/mod.rs +++ b/src/configure/mod.rs @@ -72,6 +72,7 @@ impl Context { let mut param = LoginParam::from_database(self, "").await; let success = configure(self, &mut param).await; + self.set_config(Config::NotifyAboutWrongPw, None).await?; if let Some(provider) = provider::get_provider_info(¶m.addr) { if let Some(config_defaults) = &provider.config_defaults { @@ -102,7 +103,8 @@ impl Context { match success { Ok(_) => { - self.set_config(Config::WarnedAboutWrongPw, None).await?; + self.set_config(Config::NotifyAboutWrongPw, Some("1")) + .await?; progress!(self, 1000); Ok(()) } diff --git a/src/imap/mod.rs b/src/imap/mod.rs index 0b386bf61..b6b5981b3 100644 --- a/src/imap/mod.rs +++ b/src/imap/mod.rs @@ -313,12 +313,9 @@ impl Imap { let lock = context.wrong_pw_warning_mutex.lock().await; if self.login_failed_once - && !context.get_config_bool(Config::WarnedAboutWrongPw).await + && context.get_config_bool(Config::NotifyAboutWrongPw).await { - if let Err(e) = context - .set_config(Config::WarnedAboutWrongPw, Some("1")) - .await - { + if let Err(e) = context.set_config(Config::NotifyAboutWrongPw, None).await { warn!(context, "{}", e); } drop(lock);