Merge remote-tracking branch 'origin/master' into feat/async-jobs

This commit is contained in:
dignifiedquire
2020-04-09 23:41:34 +02:00
27 changed files with 871 additions and 365 deletions

View File

@@ -11,7 +11,7 @@ use rusqlite::{Connection, Error as SqlError, OpenFlags};
use thread_local_object::ThreadLocal;
use crate::chat::{update_device_icon, update_saved_messages_icon};
use crate::constants::ShowEmails;
use crate::constants::{ShowEmails, DC_CHAT_ID_TRASH};
use crate::context::Context;
use crate::dc_tools::*;
use crate::param::*;
@@ -629,6 +629,13 @@ pub async fn housekeeping(context: &Context) {
}
}
if let Err(err) = prune_tombstones(context).await {
warn!(
context,
"Houskeeping: Cannot prune message tombstones: {}", err
);
}
info!(context, "Housekeeping done.",);
}
@@ -1325,6 +1332,19 @@ async fn open(
Ok(())
}
async fn prune_tombstones(context: &Context) -> Result<()> {
context
.sql
.execute(
"DELETE FROM msgs \
WHERE (chat_id = ? OR hidden) \
AND server_uid = 0",
paramsv![DC_CHAT_ID_TRASH],
)
.await?;
Ok(())
}
#[cfg(test)]
mod test {
use super::*;