mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 10:56:29 +03:00
Make it work
Add a mutex to prevent a race condition when a "your pw is wrong" warning is sent, resulting in multiple messeges being sent. Do not mute the device chat but "only" send MsgsChanged event when no notification shall be shown. More logging.
This commit is contained in:
@@ -308,17 +308,29 @@ impl Imap {
|
||||
.stock_string_repl_str(StockMessage::CannotLogin, &imap_user)
|
||||
.await;
|
||||
|
||||
warn!(context, "{} ({})", message, err);
|
||||
error!(context, "{}", message);
|
||||
|
||||
let lock = context.wrong_pw_warning_mutex.lock().await;
|
||||
if self.login_failed_once
|
||||
&& self.fetch
|
||||
&& !context.get_config_bool(Config::WarnedAboutWrongPw).await
|
||||
{
|
||||
context
|
||||
if let Err(e) = context
|
||||
.set_config(Config::WarnedAboutWrongPw, Some("1"))
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
warn!(context, "{}", e);
|
||||
}
|
||||
drop(lock);
|
||||
|
||||
let mut msg = Message::new(Viewtype::Text);
|
||||
msg.text = Some(message);
|
||||
chat::add_device_msg_with_importance(context, None, Some(&mut msg), true).await;
|
||||
if let Err(e) =
|
||||
chat::add_device_msg_with_importance(context, None, Some(&mut msg), true)
|
||||
.await
|
||||
{
|
||||
warn!(context, "{}", e);
|
||||
}
|
||||
} else {
|
||||
self.login_failed_once = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user