From f28f177c6b8c49c4b215650c375001c0985b8e65 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Tue, 24 Mar 2020 19:18:18 +0100 Subject: [PATCH] use constant for folders_configured cache --- src/constants.rs | 3 +++ src/imap/mod.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index 45ebe1375..50345caa1 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -214,6 +214,9 @@ pub const DC_BOB_SUCCESS: i32 = 1; // max. width/height of an avatar pub const AVATAR_SIZE: u32 = 192; +// this value can be increased if the folder configuration is changed and must be redone on next program start +pub const DC_FOLDERS_CONFIGURED_VERSION: i32 = 3; + #[derive( Debug, Display, diff --git a/src/imap/mod.rs b/src/imap/mod.rs index 834120e0e..d073e41cd 100644 --- a/src/imap/mod.rs +++ b/src/imap/mod.rs @@ -1074,9 +1074,7 @@ impl Imap { let folders_configured = context .sql .get_raw_config_int(context, "folders_configured"); - if folders_configured.unwrap_or_default() >= 3 { - // the "3" here we increase if we have future updates to - // to folder configuration + if folders_configured.unwrap_or_default() >= DC_FOLDERS_CONFIGURED_VERSION { return Ok(()); } @@ -1168,9 +1166,11 @@ impl Imap { Some(sentbox_folder.name()), )?; } - context - .sql - .set_raw_config_int(context, "folders_configured", 3)?; + context.sql.set_raw_config_int( + context, + "folders_configured", + DC_FOLDERS_CONFIGURED_VERSION, + )?; } info!(context, "FINISHED configuring IMAP-folders."); Ok(())