mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
add and test for DC_IMAP_MESSAGE_DELETED event
This commit is contained in:
@@ -3904,6 +3904,16 @@ int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
|
|||||||
*/
|
*/
|
||||||
#define DC_EVENT_SMTP_MESSAGE_SENT 103
|
#define DC_EVENT_SMTP_MESSAGE_SENT 103
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted when a message was successfully marked as deleted on the SMTP server.
|
||||||
|
*
|
||||||
|
* @param data1 0
|
||||||
|
* @param data2 (const char*) Info string in english language.
|
||||||
|
* Must not be free()'d or modified and is valid only until the callback returns.
|
||||||
|
* @return 0
|
||||||
|
*/
|
||||||
|
#define DC_EVENT_IMAP_MESSAGE_DELETED 104
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The library-user should write a warning string to the log.
|
* The library-user should write a warning string to the log.
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ impl ContextWrapper {
|
|||||||
| Event::SmtpConnected(msg)
|
| Event::SmtpConnected(msg)
|
||||||
| Event::ImapConnected(msg)
|
| Event::ImapConnected(msg)
|
||||||
| Event::SmtpMessageSent(msg)
|
| Event::SmtpMessageSent(msg)
|
||||||
|
| Event::ImapMessageDeleted(msg)
|
||||||
| Event::Warning(msg)
|
| Event::Warning(msg)
|
||||||
| Event::Error(msg)
|
| Event::Error(msg)
|
||||||
| Event::ErrorNetwork(msg)
|
| Event::ErrorNetwork(msg)
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ from os.path import join as joinpath
|
|||||||
# this works well when you in a git-checkout
|
# this works well when you in a git-checkout
|
||||||
# run "python deltachat/const.py" to regenerate events
|
# run "python deltachat/const.py" to regenerate events
|
||||||
# begin const generated
|
# begin const generated
|
||||||
DC_PROVIDER_STATUS_OK = 1
|
|
||||||
DC_PROVIDER_STATUS_PREPARATION = 2
|
|
||||||
DC_PROVIDER_STATUS_BROKEN = 3
|
|
||||||
DC_GCL_ARCHIVED_ONLY = 0x01
|
DC_GCL_ARCHIVED_ONLY = 0x01
|
||||||
DC_GCL_NO_SPECIALS = 0x02
|
DC_GCL_NO_SPECIALS = 0x02
|
||||||
DC_GCL_ADD_ALLDONE_HINT = 0x04
|
DC_GCL_ADD_ALLDONE_HINT = 0x04
|
||||||
@@ -55,6 +52,7 @@ DC_CONTACT_ID_LAST_SPECIAL = 9
|
|||||||
DC_MSG_TEXT = 10
|
DC_MSG_TEXT = 10
|
||||||
DC_MSG_IMAGE = 20
|
DC_MSG_IMAGE = 20
|
||||||
DC_MSG_GIF = 21
|
DC_MSG_GIF = 21
|
||||||
|
DC_MSG_STICKER = 23
|
||||||
DC_MSG_AUDIO = 40
|
DC_MSG_AUDIO = 40
|
||||||
DC_MSG_VOICE = 41
|
DC_MSG_VOICE = 41
|
||||||
DC_MSG_VIDEO = 50
|
DC_MSG_VIDEO = 50
|
||||||
@@ -63,6 +61,7 @@ DC_EVENT_INFO = 100
|
|||||||
DC_EVENT_SMTP_CONNECTED = 101
|
DC_EVENT_SMTP_CONNECTED = 101
|
||||||
DC_EVENT_IMAP_CONNECTED = 102
|
DC_EVENT_IMAP_CONNECTED = 102
|
||||||
DC_EVENT_SMTP_MESSAGE_SENT = 103
|
DC_EVENT_SMTP_MESSAGE_SENT = 103
|
||||||
|
DC_EVENT_IMAP_MESSAGE_DELETED = 104
|
||||||
DC_EVENT_WARNING = 300
|
DC_EVENT_WARNING = 300
|
||||||
DC_EVENT_ERROR = 400
|
DC_EVENT_ERROR = 400
|
||||||
DC_EVENT_ERROR_NETWORK = 401
|
DC_EVENT_ERROR_NETWORK = 401
|
||||||
@@ -83,6 +82,9 @@ DC_EVENT_SECUREJOIN_JOINER_PROGRESS = 2061
|
|||||||
DC_EVENT_GET_STRING = 2091
|
DC_EVENT_GET_STRING = 2091
|
||||||
DC_EVENT_FILE_COPIED = 2055
|
DC_EVENT_FILE_COPIED = 2055
|
||||||
DC_EVENT_IS_OFFLINE = 2081
|
DC_EVENT_IS_OFFLINE = 2081
|
||||||
|
DC_PROVIDER_STATUS_OK = 1
|
||||||
|
DC_PROVIDER_STATUS_PREPARATION = 2
|
||||||
|
DC_PROVIDER_STATUS_BROKEN = 3
|
||||||
# end const generated
|
# end const generated
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -596,6 +596,9 @@ class TestOnlineAccount:
|
|||||||
lp.sec("ac2: start QR-code based join-group protocol")
|
lp.sec("ac2: start QR-code based join-group protocol")
|
||||||
ch = ac2.qr_join_chat(qr)
|
ch = ac2.qr_join_chat(qr)
|
||||||
assert ch.id >= 10
|
assert ch.id >= 10
|
||||||
|
# check that at least some of the handshake messages are deleted
|
||||||
|
ac1._evlogger.get_matching("DC_EVENT_IMAP_MESSAGE_DELETED")
|
||||||
|
ac2._evlogger.get_matching("DC_EVENT_IMAP_MESSAGE_DELETED")
|
||||||
wait_securejoin_inviter_progress(ac1, 1000)
|
wait_securejoin_inviter_progress(ac1, 1000)
|
||||||
|
|
||||||
def test_qr_verified_group_and_chatting(self, acfactory, lp):
|
def test_qr_verified_group_and_chatting(self, acfactory, lp):
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ pub enum Event {
|
|||||||
#[strum(props(id = "103"))]
|
#[strum(props(id = "103"))]
|
||||||
SmtpMessageSent(String),
|
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.
|
/// The library-user should write a warning string to the log.
|
||||||
/// Passed to the callback given to dc_context_new().
|
/// Passed to the callback given to dc_context_new().
|
||||||
///
|
///
|
||||||
|
|||||||
24
src/imap.rs
24
src/imap.rs
@@ -1317,15 +1317,16 @@ impl Imap {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let set = format!("{}", server_uid);
|
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() {
|
if let Some(ref mut session) = &mut *self.session.lock().unwrap() {
|
||||||
match session.uid_fetch(set, PREFETCH_FLAGS) {
|
match session.uid_fetch(set, PREFETCH_FLAGS) {
|
||||||
Ok(msgs) => {
|
Ok(msgs) => {
|
||||||
if msgs.is_empty() {
|
if msgs.is_empty() {
|
||||||
warn!(
|
warn!(
|
||||||
context,
|
context,
|
||||||
"Cannot delete on IMAP, {}/{}: message-id gone '{}'",
|
"Cannot delete on IMAP, {}: message-id gone '{}'",
|
||||||
folder.as_ref(),
|
display_imap_id,
|
||||||
server_uid,
|
|
||||||
message_id.as_ref(),
|
message_id.as_ref(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -1336,9 +1337,8 @@ impl Imap {
|
|||||||
if remote_message_id != message_id.as_ref() {
|
if remote_message_id != message_id.as_ref() {
|
||||||
warn!(
|
warn!(
|
||||||
context,
|
context,
|
||||||
"Cannot delete on IMAP, {}/{}: remote message-id '{}' != '{}'",
|
"Cannot delete on IMAP, {}: remote message-id '{}' != '{}'",
|
||||||
folder.as_ref(),
|
display_imap_id,
|
||||||
server_uid,
|
|
||||||
remote_message_id,
|
remote_message_id,
|
||||||
message_id.as_ref(),
|
message_id.as_ref(),
|
||||||
);
|
);
|
||||||
@@ -1351,9 +1351,8 @@ impl Imap {
|
|||||||
|
|
||||||
warn!(
|
warn!(
|
||||||
context,
|
context,
|
||||||
"Cannot delete on IMAP, {}/{} not found.",
|
"Cannot delete on IMAP, {} not found.",
|
||||||
folder.as_ref(),
|
display_imap_id,
|
||||||
server_uid,
|
|
||||||
);
|
);
|
||||||
*server_uid = 0;
|
*server_uid = 0;
|
||||||
}
|
}
|
||||||
@@ -1364,6 +1363,13 @@ impl Imap {
|
|||||||
if !self.add_flag_finalized(context, *server_uid, "\\Deleted") {
|
if !self.add_flag_finalized(context, *server_uid, "\\Deleted") {
|
||||||
warn!(context, "Cannot mark message as \"Deleted\".");
|
warn!(context, "Cannot mark message as \"Deleted\".");
|
||||||
} else {
|
} 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;
|
self.config.write().unwrap().selected_folder_needs_expunge = true;
|
||||||
success = true
|
success = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -578,7 +578,6 @@ impl<'a> MimeFactory<'a> {
|
|||||||
wrapmime::set_body_text(mach_mime_part, &message_text2)?;
|
wrapmime::set_body_text(mach_mime_part, &message_text2)?;
|
||||||
mailmime_add_part(multipart, mach_mime_part);
|
mailmime_add_part(multipart, mach_mime_part);
|
||||||
force_plaintext = DC_FP_NO_AUTOCRYPT_HEADER;
|
force_plaintext = DC_FP_NO_AUTOCRYPT_HEADER;
|
||||||
info!(context, "sending MDM {:?}", message_text2);
|
|
||||||
/* currently, we do not send MDNs encrypted:
|
/* 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
|
- 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.
|
are send automatically which may lead to spreading outdated Autocrypt headers.
|
||||||
|
|||||||
Reference in New Issue
Block a user