Store contact ID in SendMdn job foreign_id

This change makes it possible to find all pending MDNs for the contact
with an SQL query.
This commit is contained in:
Alexander Krotov
2020-01-17 01:13:15 +03:00
parent e7f4898e90
commit a5c8e9e72e
2 changed files with 25 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ use num_traits::FromPrimitive;
use crate::blob::{BlobError, BlobObject};
use crate::context::Context;
use crate::error;
use crate::message::MsgId;
use crate::mimeparser::SystemMessage;
/// Available param keys.
@@ -116,6 +117,9 @@ pub enum Param {
/// For QR
GroupName = b'g',
/// For MDN-sending job
MessageId = b'I',
}
/// Possible values for `Param::ForcePlaintext`.
@@ -312,6 +316,12 @@ impl Params {
Ok(Some(path))
}
pub fn get_msg_id(&self) -> Option<MsgId> {
self.get(Param::MessageId)
.and_then(|x| x.parse::<u32>().ok())
.map(MsgId::new)
}
/// Set the given paramter to the passed in `i32`.
pub fn set_int(&mut self, key: Param, value: i32) -> &mut Self {
self.set(key, format!("{}", value));