More explicit

This commit is contained in:
Hocuri
2020-06-13 20:26:16 +02:00
parent ae2fd4014a
commit 86bc54508f
4 changed files with 9 additions and 7 deletions

View File

@@ -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>,

View File

@@ -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 {

View File

@@ -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(&param.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(())
}

View File

@@ -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);