mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 17:06:35 +03:00
Merge pull request #862 from deltachat/fix-bcc-self
mark messages as sent
This commit is contained in:
38
src/job.rs
38
src/job.rs
@@ -182,23 +182,7 @@ impl Job {
|
|||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
// smtp success, update db ASAP, then delete smtp file
|
// smtp success, update db ASAP, then delete smtp file
|
||||||
if 0 != self.foreign_id {
|
if 0 != self.foreign_id {
|
||||||
message::update_msg_state(
|
set_delivered(context, MsgId::new(self.foreign_id));
|
||||||
context,
|
|
||||||
MsgId::new(self.foreign_id),
|
|
||||||
MessageState::OutDelivered,
|
|
||||||
);
|
|
||||||
let chat_id: i32 = context
|
|
||||||
.sql
|
|
||||||
.query_get_value(
|
|
||||||
context,
|
|
||||||
"SELECT chat_id FROM msgs WHERE id=?",
|
|
||||||
params![self.foreign_id as i32],
|
|
||||||
)
|
|
||||||
.unwrap_or_default();
|
|
||||||
context.call_cb(Event::MsgDelivered {
|
|
||||||
chat_id: chat_id as u32,
|
|
||||||
msg_id: MsgId::new(self.foreign_id),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// now also delete the generated file
|
// now also delete the generated file
|
||||||
dc_delete_file(context, filename);
|
dc_delete_file(context, filename);
|
||||||
@@ -579,6 +563,22 @@ pub fn job_action_exists(context: &Context, action: Action) -> bool {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_delivered(context: &Context, msg_id: MsgId) {
|
||||||
|
message::update_msg_state(context, msg_id, MessageState::OutDelivered);
|
||||||
|
let chat_id: i32 = context
|
||||||
|
.sql
|
||||||
|
.query_get_value(
|
||||||
|
context,
|
||||||
|
"SELECT chat_id FROM msgs WHERE id=?",
|
||||||
|
params![msg_id],
|
||||||
|
)
|
||||||
|
.unwrap_or_default();
|
||||||
|
context.call_cb(Event::MsgDelivered {
|
||||||
|
chat_id: chat_id as u32,
|
||||||
|
msg_id: msg_id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* special case for DC_JOB_SEND_MSG_TO_SMTP */
|
/* special case for DC_JOB_SEND_MSG_TO_SMTP */
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<(), Error> {
|
pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<(), Error> {
|
||||||
@@ -640,10 +640,12 @@ pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if mimefactory.recipients_addr.is_empty() {
|
if mimefactory.recipients_addr.is_empty() {
|
||||||
warn!(
|
// may happen eg. for groups with only SELF and bcc_self disabled
|
||||||
|
info!(
|
||||||
context,
|
context,
|
||||||
"message {} has no recipient, skipping smtp-send", msg_id
|
"message {} has no recipient, skipping smtp-send", msg_id
|
||||||
);
|
);
|
||||||
|
set_delivered(context, msg_id);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user