|
|
@ -164,7 +164,7 @@ pub struct FileAccount {
|
|
|
|
#[serde(default)]
|
|
|
|
#[serde(default)]
|
|
|
|
mailboxes: HashMap<String, FileMailboxConf>,
|
|
|
|
mailboxes: HashMap<String, FileMailboxConf>,
|
|
|
|
#[serde(default)]
|
|
|
|
#[serde(default)]
|
|
|
|
cache_type: CacheType,
|
|
|
|
search_backend: SearchBackend,
|
|
|
|
#[serde(default = "false_val")]
|
|
|
|
#[serde(default = "false_val")]
|
|
|
|
pub manual_refresh: bool,
|
|
|
|
pub manual_refresh: bool,
|
|
|
|
#[serde(default = "none")]
|
|
|
|
#[serde(default = "none")]
|
|
|
@ -220,8 +220,8 @@ impl FileAccount {
|
|
|
|
&self.root_mailbox
|
|
|
|
&self.root_mailbox
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn cache_type(&self) -> &CacheType {
|
|
|
|
pub fn search_backend(&self) -> &SearchBackend {
|
|
|
|
&self.cache_type
|
|
|
|
&self.search_backend
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -417,7 +417,7 @@ impl FileSettings {
|
|
|
|
extra,
|
|
|
|
extra,
|
|
|
|
manual_refresh,
|
|
|
|
manual_refresh,
|
|
|
|
refresh_command: _,
|
|
|
|
refresh_command: _,
|
|
|
|
cache_type: _,
|
|
|
|
search_backend: _,
|
|
|
|
conf_override: _,
|
|
|
|
conf_override: _,
|
|
|
|
} = acc.clone();
|
|
|
|
} = acc.clone();
|
|
|
|
|
|
|
|
|
|
|
@ -630,26 +630,26 @@ impl Serialize for IndexStyle {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
|
|
pub enum CacheType {
|
|
|
|
pub enum SearchBackend {
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
Sqlite3,
|
|
|
|
Sqlite3,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for CacheType {
|
|
|
|
impl Default for SearchBackend {
|
|
|
|
fn default() -> Self {
|
|
|
|
fn default() -> Self {
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CacheType::Sqlite3
|
|
|
|
SearchBackend::Sqlite3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[cfg(not(feature = "sqlite3"))]
|
|
|
|
#[cfg(not(feature = "sqlite3"))]
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CacheType::None
|
|
|
|
SearchBackend::None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<'de> Deserialize<'de> for CacheType {
|
|
|
|
impl<'de> Deserialize<'de> for SearchBackend {
|
|
|
|
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
|
|
|
|
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
|
|
|
|
where
|
|
|
|
where
|
|
|
|
D: Deserializer<'de>,
|
|
|
|
D: Deserializer<'de>,
|
|
|
@ -657,22 +657,22 @@ impl<'de> Deserialize<'de> for CacheType {
|
|
|
|
let s = <String>::deserialize(deserializer)?;
|
|
|
|
let s = <String>::deserialize(deserializer)?;
|
|
|
|
match s.as_str() {
|
|
|
|
match s.as_str() {
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
"sqlite3" => Ok(CacheType::Sqlite3),
|
|
|
|
"sqlite3" => Ok(SearchBackend::Sqlite3),
|
|
|
|
"nothing" | "none" | "" => Ok(CacheType::None),
|
|
|
|
"nothing" | "none" | "" => Ok(SearchBackend::None),
|
|
|
|
_ => Err(de::Error::custom("invalid `index_cache` value")),
|
|
|
|
_ => Err(de::Error::custom("invalid `search_backend` value")),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Serialize for CacheType {
|
|
|
|
impl Serialize for SearchBackend {
|
|
|
|
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
|
|
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
|
|
where
|
|
|
|
where
|
|
|
|
S: Serializer,
|
|
|
|
S: Serializer,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
match self {
|
|
|
|
match self {
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
#[cfg(feature = "sqlite3")]
|
|
|
|
CacheType::Sqlite3 => serializer.serialize_str("sqlite3"),
|
|
|
|
SearchBackend::Sqlite3 => serializer.serialize_str("sqlite3"),
|
|
|
|
CacheType::None => serializer.serialize_str("none"),
|
|
|
|
SearchBackend::None => serializer.serialize_str("none"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|