mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
add and test for DC_IMAP_MESSAGE_DELETED event
This commit is contained in:
@@ -42,6 +42,12 @@ pub enum Event {
|
||||
#[strum(props(id = "103"))]
|
||||
SmtpMessageSent(String),
|
||||
|
||||
/// Emitted when an IMAP message has been marked as deleted
|
||||
///
|
||||
/// @return 0
|
||||
#[strum(props(id = "104"))]
|
||||
ImapMessageDeleted(String),
|
||||
|
||||
/// The library-user should write a warning string to the log.
|
||||
/// Passed to the callback given to dc_context_new().
|
||||
///
|
||||
|
||||
24
src/imap.rs
24
src/imap.rs
@@ -1317,15 +1317,16 @@ impl Imap {
|
||||
);
|
||||
} else {
|
||||
let set = format!("{}", server_uid);
|
||||
let display_imap_id = format!("{}/{}", folder.as_ref(), server_uid);
|
||||
|
||||
if let Some(ref mut session) = &mut *self.session.lock().unwrap() {
|
||||
match session.uid_fetch(set, PREFETCH_FLAGS) {
|
||||
Ok(msgs) => {
|
||||
if msgs.is_empty() {
|
||||
warn!(
|
||||
context,
|
||||
"Cannot delete on IMAP, {}/{}: message-id gone '{}'",
|
||||
folder.as_ref(),
|
||||
server_uid,
|
||||
"Cannot delete on IMAP, {}: message-id gone '{}'",
|
||||
display_imap_id,
|
||||
message_id.as_ref(),
|
||||
);
|
||||
} else {
|
||||
@@ -1336,9 +1337,8 @@ impl Imap {
|
||||
if remote_message_id != message_id.as_ref() {
|
||||
warn!(
|
||||
context,
|
||||
"Cannot delete on IMAP, {}/{}: remote message-id '{}' != '{}'",
|
||||
folder.as_ref(),
|
||||
server_uid,
|
||||
"Cannot delete on IMAP, {}: remote message-id '{}' != '{}'",
|
||||
display_imap_id,
|
||||
remote_message_id,
|
||||
message_id.as_ref(),
|
||||
);
|
||||
@@ -1351,9 +1351,8 @@ impl Imap {
|
||||
|
||||
warn!(
|
||||
context,
|
||||
"Cannot delete on IMAP, {}/{} not found.",
|
||||
folder.as_ref(),
|
||||
server_uid,
|
||||
"Cannot delete on IMAP, {} not found.",
|
||||
display_imap_id,
|
||||
);
|
||||
*server_uid = 0;
|
||||
}
|
||||
@@ -1364,6 +1363,13 @@ impl Imap {
|
||||
if !self.add_flag_finalized(context, *server_uid, "\\Deleted") {
|
||||
warn!(context, "Cannot mark message as \"Deleted\".");
|
||||
} else {
|
||||
emit_event!(
|
||||
context,
|
||||
Event::ImapMessageDeleted(format!(
|
||||
"IMAP Message {} marked as deleted [{}]",
|
||||
display_imap_id, message_id.as_ref()
|
||||
))
|
||||
);
|
||||
self.config.write().unwrap().selected_folder_needs_expunge = true;
|
||||
success = true
|
||||
}
|
||||
|
||||
@@ -578,7 +578,6 @@ impl<'a> MimeFactory<'a> {
|
||||
wrapmime::set_body_text(mach_mime_part, &message_text2)?;
|
||||
mailmime_add_part(multipart, mach_mime_part);
|
||||
force_plaintext = DC_FP_NO_AUTOCRYPT_HEADER;
|
||||
info!(context, "sending MDM {:?}", message_text2);
|
||||
/* currently, we do not send MDNs encrypted:
|
||||
- in a multi-device-setup that is not set up properly, MDNs would disturb the communication as they
|
||||
are send automatically which may lead to spreading outdated Autocrypt headers.
|
||||
|
||||
Reference in New Issue
Block a user