Set autodelete timer columns for outgoing messages

This commit is contained in:
Alexander Krotov
2020-01-07 16:35:31 +03:00
parent a830d499eb
commit 6002f54ce1

View File

@@ -882,12 +882,16 @@ impl Chat {
);
}
// get autodelete timer
let autodelete_timer = Some(get_autodelete_timer(context, self.id)).filter(|&x| x != 0);
let autodelete_timestamp = autodelete_timer.map(|x| timestamp + i64::from(x));
// add message to the database
if sql::execute(
context,
&context.sql,
"INSERT INTO msgs (rfc724_mid, chat_id, from_id, to_id, timestamp, type, state, txt, param, hidden, mime_in_reply_to, mime_references, location_id) VALUES (?,?,?,?,?, ?,?,?,?,?, ?,?,?);",
"INSERT INTO msgs (rfc724_mid, chat_id, from_id, to_id, timestamp, type, state, txt, param, hidden, mime_in_reply_to, mime_references, location_id, autodelete_timer, autodelete_timestamp) VALUES (?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?);",
params![
new_rfc724_mid,
self.id,
@@ -902,6 +906,8 @@ impl Chat {
new_in_reply_to,
new_references,
location_id as i32,
autodelete_timer,
autodelete_timestamp
]
).is_ok() {
msg_id = sql::get_rowid(