mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
use enum for show_emails
This commit is contained in:
committed by
holger krekel
parent
9506f8c38e
commit
84c6113271
@@ -1,6 +1,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use itertools::Itertools;
|
||||
use num_traits::FromPrimitive;
|
||||
|
||||
use crate::blob::{BlobErrorKind, BlobObject};
|
||||
use crate::chatlist::*;
|
||||
@@ -1012,7 +1013,8 @@ pub fn get_chat_msgs(
|
||||
Ok(ret)
|
||||
};
|
||||
let success = if chat_id == DC_CHAT_ID_DEADDROP {
|
||||
let show_emails = context.get_config_int(Config::ShowEmails);
|
||||
let show_emails =
|
||||
ShowEmails::from_i32(context.get_config_int(Config::ShowEmails)).unwrap_or_default();
|
||||
context.sql.query_map(
|
||||
concat!(
|
||||
"SELECT m.id AS id, m.timestamp AS timestamp",
|
||||
@@ -1029,7 +1031,7 @@ pub fn get_chat_msgs(
|
||||
" AND m.msgrmsg>=?",
|
||||
" ORDER BY m.timestamp,m.id;"
|
||||
),
|
||||
params![if show_emails == 2 { 0 } else { 1 }],
|
||||
params![if show_emails == ShowEmails::All { 0 } else { 1 }],
|
||||
process_row,
|
||||
process_rows,
|
||||
)
|
||||
|
||||
@@ -5,6 +5,7 @@ use std::time::Duration;
|
||||
use rusqlite::{Connection, OpenFlags, Statement, NO_PARAMS};
|
||||
use thread_local_object::ThreadLocal;
|
||||
|
||||
use crate::constants::ShowEmails;
|
||||
use crate::context::Context;
|
||||
use crate::dc_tools::*;
|
||||
use crate::error::{Error, Result};
|
||||
@@ -736,7 +737,7 @@ fn open(
|
||||
if dbversion < 50 {
|
||||
info!(context, "[migration] v50");
|
||||
if exists_before_update {
|
||||
sql.set_raw_config_int(context, "show_emails", 2)?;
|
||||
sql.set_raw_config_int(context, "show_emails", ShowEmails::All as i32)?;
|
||||
}
|
||||
dbversion = 50;
|
||||
sql.set_raw_config_int(context, "dbversion", 50)?;
|
||||
|
||||
Reference in New Issue
Block a user