mirror of
https://github.com/chatmail/core.git
synced 2026-05-17 05:46:30 +03:00
intermediate commit
This commit is contained in:
@@ -207,7 +207,8 @@ unsafe fn cb_precheck_imf(
|
|||||||
server_uid
|
server_uid
|
||||||
);
|
);
|
||||||
if let Some(res) = dc_rfc724_mid_exists_with_msg_state(context, rfc724_mid) {
|
if let Some(res) = dc_rfc724_mid_exists_with_msg_state(context, rfc724_mid) {
|
||||||
let (msg_id, msg_state, old_server_folder, old_server_uid) = res;
|
let (msg_id, _, old_server_folder, old_server_uid) = res;
|
||||||
|
info!(context, 0, "precheck msg_id={}", msg_id);
|
||||||
if msg_id != 0 {
|
if msg_id != 0 {
|
||||||
if old_server_folder.is_empty() {
|
if old_server_folder.is_empty() {
|
||||||
info!(context, 0, "[move] detected bbc-self {}", rfc724_mid,);
|
info!(context, 0, "[move] detected bbc-self {}", rfc724_mid,);
|
||||||
@@ -216,21 +217,14 @@ unsafe fn cb_precheck_imf(
|
|||||||
info!(context, 0, "[move] detected moved message {}", rfc724_mid,);
|
info!(context, 0, "[move] detected moved message {}", rfc724_mid,);
|
||||||
}
|
}
|
||||||
dc_update_msg_move_state(context, rfc724_mid, MoveState::Stay);
|
dc_update_msg_move_state(context, rfc724_mid, MoveState::Stay);
|
||||||
if msg_state == MessageState::InSeen {
|
|
||||||
// Message is maybe moved from another folder.
|
|
||||||
// trigger MDN receipts
|
|
||||||
info!(
|
|
||||||
context,
|
|
||||||
0,
|
|
||||||
"InSeen msgid={} server_uid={} server_folder={}",
|
|
||||||
msg_id,
|
|
||||||
server_uid,
|
|
||||||
server_folder,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if old_server_folder != server_folder || old_server_uid != server_uid {
|
if old_server_folder != server_folder || old_server_uid != server_uid {
|
||||||
|
info!(
|
||||||
|
context,
|
||||||
|
0, "precheck updated server_uid for msg_id={}", msg_id
|
||||||
|
);
|
||||||
dc_update_server_uid(context, rfc724_mid, server_folder, server_uid);
|
dc_update_server_uid(context, rfc724_mid, server_folder, server_uid);
|
||||||
|
job_retry_msg_actions_at_once(context, msg_id);
|
||||||
}
|
}
|
||||||
dc_do_heuristics_moves(context, server_folder, msg_id);
|
dc_do_heuristics_moves(context, server_folder, msg_id);
|
||||||
if mark_seen {
|
if mark_seen {
|
||||||
|
|||||||
26
src/job.rs
26
src/job.rs
@@ -284,7 +284,14 @@ impl Job {
|
|||||||
self.try_again_later(Delay::Standard, None);
|
self.try_again_later(Delay::Standard, None);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(msg) = dc_msg_load_from_db(context, self.foreign_id) {
|
if let Ok(msg) = dc_msg_load_from_db(context, self.foreign_id) {
|
||||||
|
if msg.server_uid == 0 {
|
||||||
|
// the message has likely been moved
|
||||||
|
// try again later
|
||||||
|
self.try_again_later(Delay::Standard, None);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let server_folder = msg.server_folder.as_ref().unwrap();
|
let server_folder = msg.server_folder.as_ref().unwrap();
|
||||||
info!(context, 0, "job_markseen_msg db id={}", self.foreign_id);
|
info!(context, 0, "job_markseen_msg db id={}", self.foreign_id);
|
||||||
match inbox.set_seen(context, server_folder, msg.server_uid) {
|
match inbox.set_seen(context, server_folder, msg.server_uid) {
|
||||||
@@ -310,7 +317,7 @@ impl Job {
|
|||||||
.unwrap_or_else(|| 1)
|
.unwrap_or_else(|| 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/* XXX
|
||||||
if 0 != msg.param.get_int(Param::WantsMdn).unwrap_or_default()
|
if 0 != msg.param.get_int(Param::WantsMdn).unwrap_or_default()
|
||||||
&& 0 != context
|
&& 0 != context
|
||||||
.sql
|
.sql
|
||||||
@@ -602,6 +609,21 @@ pub fn maybe_network(context: &Context) {
|
|||||||
interrupt_sentbox_idle(context);
|
interrupt_sentbox_idle(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn job_retry_msg_actions_at_once(context: &Context, msg_id: uint32_t) -> bool {
|
||||||
|
match sql::execute(
|
||||||
|
context,
|
||||||
|
&context.sql,
|
||||||
|
"UPDATE jobs SET desired_timestamp=? WHERE foreign_id=?;",
|
||||||
|
params![time(), msg_id],
|
||||||
|
) {
|
||||||
|
Ok(_) => true,
|
||||||
|
Err(_err) => {
|
||||||
|
info!(context, 0, "job-retry-at-once failed {:?}", _err);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn job_action_exists(context: &Context, action: Action) -> bool {
|
pub fn job_action_exists(context: &Context, action: Action) -> bool {
|
||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
@@ -960,7 +982,7 @@ fn connect_to_inbox(context: &Context, inbox: &Imap) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_mdn(context: &Context, msg_id: uint32_t) {
|
pub fn send_mdn(context: &Context, msg_id: uint32_t) {
|
||||||
if let Ok(mut mimefactory) = unsafe { dc_mimefactory_load_mdn(context, msg_id) } {
|
if let Ok(mut mimefactory) = unsafe { dc_mimefactory_load_mdn(context, msg_id) } {
|
||||||
if 0 != unsafe { dc_mimefactory_render(&mut mimefactory) } {
|
if 0 != unsafe { dc_mimefactory_render(&mut mimefactory) } {
|
||||||
add_smtp_job(context, Action::SendMdn, &mut mimefactory);
|
add_smtp_job(context, Action::SendMdn, &mut mimefactory);
|
||||||
|
|||||||
Reference in New Issue
Block a user