mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 23:36:30 +03:00
feat: add support for locked/encrypted accounts to jsonrpc api
api!: jsonrpc new variant of `Account` enum: `Account::Locked`.
This commit is contained in:
@@ -23,10 +23,15 @@ pub enum Account {
|
|||||||
},
|
},
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Unconfigured { id: u32 },
|
Unconfigured { id: u32 },
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
Locked { id: u32 },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Account {
|
impl Account {
|
||||||
pub async fn from_context(ctx: &deltachat::context::Context, id: u32) -> Result<Self> {
|
pub async fn from_context(ctx: &deltachat::context::Context, id: u32) -> Result<Self> {
|
||||||
|
if !ctx.is_open().await {
|
||||||
|
return Ok(Account::Locked { id });
|
||||||
|
}
|
||||||
if ctx.is_configured().await? {
|
if ctx.is_configured().await? {
|
||||||
let display_name = ctx.get_config(Config::Displayname).await?;
|
let display_name = ctx.get_config(Config::Displayname).await?;
|
||||||
let addr = ctx.get_config(Config::Addr).await?;
|
let addr = ctx.get_config(Config::Addr).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user