mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
refactor: cleanup config values and move to their own file
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use deltachat::config;
|
||||
use deltachat::constants::*;
|
||||
use deltachat::context::*;
|
||||
use deltachat::dc_array::*;
|
||||
@@ -481,7 +482,7 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
|
||||
},
|
||||
"auth" => {
|
||||
if 0 == S_IS_AUTH {
|
||||
let is_pw = dc_get_config(context, "mail_pw");
|
||||
let is_pw = config::get(context, "mail_pw");
|
||||
if arg1 == is_pw {
|
||||
S_IS_AUTH = 1;
|
||||
} else {
|
||||
@@ -602,13 +603,13 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
|
||||
"set" => {
|
||||
ensure!(!arg1.is_empty(), "Argument <key> missing.");
|
||||
ensure!(
|
||||
0 != dc_set_config(context, &arg1, Some(&arg2)),
|
||||
0 != config::set(context, &arg1, Some(&arg2)),
|
||||
"Set config failed"
|
||||
);
|
||||
}
|
||||
"get" => {
|
||||
ensure!(!arg1.is_empty(), "Argument <key> missing.");
|
||||
let val = dc_get_config(context, &arg1);
|
||||
let val = config::get(context, &arg1);
|
||||
println!("{}={}", arg1, val);
|
||||
}
|
||||
"info" => {
|
||||
|
||||
@@ -17,6 +17,7 @@ use std::borrow::Cow::{self, Borrowed, Owned};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
|
||||
use deltachat::config;
|
||||
use deltachat::constants::*;
|
||||
use deltachat::context::*;
|
||||
use deltachat::dc_configure::*;
|
||||
@@ -514,7 +515,7 @@ unsafe fn handle_cmd(line: &str, ctx: Arc<RwLock<Context>>) -> Result<ExitResult
|
||||
dc_configure(&ctx.read().unwrap());
|
||||
}
|
||||
"oauth2" => {
|
||||
let addr = dc_get_config(&ctx.read().unwrap(), "addr");
|
||||
let addr = config::get(&ctx.read().unwrap(), "addr");
|
||||
if addr.is_empty() {
|
||||
println!("oauth2: set addr first.");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user