diff --git a/src/chat.rs b/src/chat.rs index 5d8f88da1..b81c066ff 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -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(