From 99c4d24eab0a6afbc1b4f0c5c052d245deb0b042 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Fri, 29 Mar 2024 22:14:06 +0100 Subject: [PATCH] cleanup `jobs` and `Params` relicts - the `jobs` table is no longer in use, no need to track files on housekeeping, no need to clear it from repl tool - some `Params` were used for jobs table only, they can be used freely for other purposes on other tables. param 'protection settings timestamp' was never used in practise, its code is removed as well, so we can free the Param as well. --- deltachat-repl/src/cmdline.rs | 8 -------- src/param.rs | 23 ++++------------------- src/sql.rs | 7 ------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/deltachat-repl/src/cmdline.rs b/deltachat-repl/src/cmdline.rs index 28a166630..feee46bd4 100644 --- a/deltachat-repl/src/cmdline.rs +++ b/deltachat-repl/src/cmdline.rs @@ -33,14 +33,6 @@ use tokio::fs; /// e.g. bitmask 7 triggers actions defined with bits 1, 2 and 4. async fn reset_tables(context: &Context, bits: i32) { println!("Resetting tables ({bits})..."); - if 0 != bits & 1 { - context - .sql() - .execute("DELETE FROM jobs;", ()) - .await - .unwrap(); - println!("(1) Jobs reset."); - } if 0 != bits & 2 { context .sql() diff --git a/src/param.rs b/src/param.rs index d035d2d11..19f2eb8fa 100644 --- a/src/param.rs +++ b/src/param.rs @@ -9,7 +9,6 @@ use serde::{Deserialize, Serialize}; use crate::blob::BlobObject; use crate::context::Context; -use crate::message::MsgId; use crate::mimeparser::SystemMessage; /// Available param keys. @@ -18,7 +17,7 @@ use crate::mimeparser::SystemMessage; )] #[repr(u8)] pub enum Param { - /// For messages and jobs + /// For messages File = b'f', /// For messages: original filename (as shown in chat) @@ -107,18 +106,12 @@ pub enum Param { /// is used to also send all the forwarded messages. PrepForwards = b'P', - /// For Jobs + /// For Messages SetLatitude = b'l', - /// For Jobs + /// For Messages SetLongitude = b'n', - /// For Jobs - AlsoMove = b'M', - - /// For MDN-sending job - MsgId = b'I', - /// For Groups /// /// An unpromoted group has not had any messages sent to it and thus only exists on the @@ -173,9 +166,6 @@ pub enum Param { /// For Chats: timestamp of member list update. MemberListTimestamp = b'k', - /// For Chats: timestamp of protection settings update. - ProtectionSettingsTimestamp = b'L', - /// For Webxdc Message Instances: Current document name WebxdcDocument = b'R', @@ -190,6 +180,7 @@ pub enum Param { /// For messages: Whether [crate::message::Viewtype::Sticker] should be forced. ForceSticker = b'X', + // 'L' was defined as ProtectionSettingsTimestamp for Chats, however, never used in production. } /// An object for handling key=value parameter lists. @@ -399,12 +390,6 @@ impl Params { Ok(Some(path)) } - pub fn get_msg_id(&self) -> Option { - self.get(Param::MsgId) - .and_then(|x| x.parse().ok()) - .map(MsgId::new) - } - /// Set the given parameter to the passed in `i32`. pub fn set_int(&mut self, key: Param, value: i32) -> &mut Self { self.set(key, format!("{value}")); diff --git a/src/sql.rs b/src/sql.rs index 20774d852..1a43acf8e 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -806,13 +806,6 @@ pub async fn remove_unused_files(context: &Context) -> Result<()> { Param::File, ) .await?; - maybe_add_from_param( - &context.sql, - &mut files_in_use, - "SELECT param FROM jobs;", - Param::File, - ) - .await?; maybe_add_from_param( &context.sql, &mut files_in_use,