mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
Only reset status to "" if a text/plain part without signature is received
Otherwise sending a message without plaintext part resets the signature. It is particularly dangerous in multidevice case, because it's easy to accidentally reset the signature on your other device with a non-text message.
This commit is contained in:
@@ -309,28 +309,25 @@ pub(crate) async fn receive_imf_inner(
|
||||
}
|
||||
}
|
||||
|
||||
// Always update the status, even if there is no footer, to allow removing the status.
|
||||
//
|
||||
// Ignore MDNs though, as they never contain the signature even if user has set it.
|
||||
// Ignore footers from mailinglists as they are often created or modified by the mailinglist software.
|
||||
if mime_parser.mdn_reports.is_empty()
|
||||
&& !mime_parser.is_mailinglist_message()
|
||||
&& is_partial_download.is_none()
|
||||
&& from_id != ContactId::UNDEFINED
|
||||
&& context
|
||||
.update_contacts_timestamp(from_id, Param::StatusTimestamp, sent_timestamp)
|
||||
.await?
|
||||
{
|
||||
if let Err(err) = contact::set_status(
|
||||
context,
|
||||
from_id,
|
||||
mime_parser.footer.clone().unwrap_or_default(),
|
||||
mime_parser.was_encrypted(),
|
||||
mime_parser.has_chat_version(),
|
||||
)
|
||||
.await
|
||||
if let Some(footer) = &mime_parser.footer {
|
||||
if !mime_parser.is_mailinglist_message()
|
||||
&& from_id != ContactId::UNDEFINED
|
||||
&& context
|
||||
.update_contacts_timestamp(from_id, Param::StatusTimestamp, sent_timestamp)
|
||||
.await?
|
||||
{
|
||||
warn!(context, "Cannot update contact status: {err:#}.");
|
||||
if let Err(err) = contact::set_status(
|
||||
context,
|
||||
from_id,
|
||||
footer.to_string(),
|
||||
mime_parser.was_encrypted(),
|
||||
mime_parser.has_chat_version(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
warn!(context, "Cannot update contact status: {err:#}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user