mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
Move foreign_id handling out of mimefactory
This commit is contained in:
20
src/job.rs
20
src/job.rs
@@ -785,7 +785,7 @@ pub fn job_send_msg(context: &Context, msg_id: MsgId) -> Result<()> {
|
|||||||
msg.save_param_to_disk(context);
|
msg.save_param_to_disk(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_smtp_job(context, Action::SendMsgToSmtp, &rendered_msg)?;
|
add_smtp_job(context, Action::SendMsgToSmtp, msg.id, &rendered_msg)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -1010,7 +1010,12 @@ fn send_mdn(context: &Context, msg_id: MsgId) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_smtp_job(context: &Context, action: Action, rendered_msg: &RenderedEmail) -> Result<()> {
|
fn add_smtp_job(
|
||||||
|
context: &Context,
|
||||||
|
action: Action,
|
||||||
|
msg_id: MsgId,
|
||||||
|
rendered_msg: &RenderedEmail,
|
||||||
|
) -> Result<()> {
|
||||||
ensure!(
|
ensure!(
|
||||||
!rendered_msg.recipients.is_empty(),
|
!rendered_msg.recipients.is_empty(),
|
||||||
"no recipients for smtp job set"
|
"no recipients for smtp job set"
|
||||||
@@ -1023,16 +1028,7 @@ fn add_smtp_job(context: &Context, action: Action, rendered_msg: &RenderedEmail)
|
|||||||
param.set(Param::File, blob.as_name());
|
param.set(Param::File, blob.as_name());
|
||||||
param.set(Param::Recipients, &recipients);
|
param.set(Param::Recipients, &recipients);
|
||||||
|
|
||||||
job_add(
|
job_add(context, action, msg_id.to_u32() as i32, param, 0);
|
||||||
context,
|
|
||||||
action,
|
|
||||||
rendered_msg
|
|
||||||
.foreign_id
|
|
||||||
.map(|v| v.to_u32() as i32)
|
|
||||||
.unwrap_or_default(),
|
|
||||||
param,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use crate::dc_tools::*;
|
|||||||
use crate::e2ee::*;
|
use crate::e2ee::*;
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::location;
|
use crate::location;
|
||||||
use crate::message::MsgId;
|
|
||||||
use crate::message::{self, Message};
|
use crate::message::{self, Message};
|
||||||
use crate::mimeparser::SystemMessage;
|
use crate::mimeparser::SystemMessage;
|
||||||
use crate::param::*;
|
use crate::param::*;
|
||||||
@@ -53,8 +52,6 @@ pub struct RenderedEmail {
|
|||||||
pub is_encrypted: bool,
|
pub is_encrypted: bool,
|
||||||
pub is_gossiped: bool,
|
pub is_gossiped: bool,
|
||||||
pub last_added_location_id: u32,
|
pub last_added_location_id: u32,
|
||||||
/// None for MDN, the message id otherwise
|
|
||||||
pub foreign_id: Option<MsgId>,
|
|
||||||
|
|
||||||
pub from: String,
|
pub from: String,
|
||||||
pub recipients: Vec<String>,
|
pub recipients: Vec<String>,
|
||||||
@@ -563,8 +560,6 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
recipients,
|
recipients,
|
||||||
from_addr,
|
from_addr,
|
||||||
last_added_location_id,
|
last_added_location_id,
|
||||||
msg,
|
|
||||||
loaded,
|
|
||||||
..
|
..
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
@@ -574,10 +569,6 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
is_encrypted,
|
is_encrypted,
|
||||||
is_gossiped,
|
is_gossiped,
|
||||||
last_added_location_id,
|
last_added_location_id,
|
||||||
foreign_id: match loaded {
|
|
||||||
Loaded::Message { .. } => Some(msg.id),
|
|
||||||
Loaded::MDN => None,
|
|
||||||
},
|
|
||||||
recipients: recipients.into_iter().map(|(_, addr)| addr).collect(),
|
recipients: recipients.into_iter().map(|(_, addr)| addr).collect(),
|
||||||
from: from_addr,
|
from: from_addr,
|
||||||
rfc724_mid,
|
rfc724_mid,
|
||||||
|
|||||||
Reference in New Issue
Block a user