mirror of
https://github.com/chatmail/core.git
synced 2026-05-18 22:36:29 +03:00
cargo fmt
This commit is contained in:
@@ -150,61 +150,60 @@ unsafe fn poke_spec(context: &Context, spec: *const libc::c_char) -> libc::c_int
|
|||||||
real_spec = rs.unwrap_or_default().strdup();
|
real_spec = rs.unwrap_or_default().strdup();
|
||||||
}
|
}
|
||||||
if ok_to_continue {
|
if ok_to_continue {
|
||||||
let ok_to_continue2;
|
let ok_to_continue2;
|
||||||
suffix = dc_get_filesuffix_lc(real_spec);
|
suffix = dc_get_filesuffix_lc(real_spec);
|
||||||
if !suffix.is_null()
|
if !suffix.is_null() && strcmp(suffix, b"eml\x00" as *const u8 as *const libc::c_char) == 0
|
||||||
&& strcmp(suffix, b"eml\x00" as *const u8 as *const libc::c_char) == 0
|
{
|
||||||
{
|
if 0 != dc_poke_eml_file(context, real_spec) {
|
||||||
if 0 != dc_poke_eml_file(context, real_spec) {
|
read_cnt += 1
|
||||||
read_cnt += 1
|
}
|
||||||
|
ok_to_continue2 = true;
|
||||||
|
} else {
|
||||||
|
/* import a directory */
|
||||||
|
let dir_name = std::path::Path::new(as_str(real_spec));
|
||||||
|
let dir = std::fs::read_dir(dir_name);
|
||||||
|
if dir.is_err() {
|
||||||
|
error!(
|
||||||
|
context,
|
||||||
|
0,
|
||||||
|
"Import: Cannot open directory \"{}\".",
|
||||||
|
as_str(real_spec),
|
||||||
|
);
|
||||||
|
ok_to_continue2 = false;
|
||||||
|
} else {
|
||||||
|
let dir = dir.unwrap();
|
||||||
|
for entry in dir {
|
||||||
|
if entry.is_err() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let entry = entry.unwrap();
|
||||||
|
let name_f = entry.file_name();
|
||||||
|
let name = name_f.to_string_lossy();
|
||||||
|
if name.ends_with(".eml") {
|
||||||
|
let path_plus_name = format!("{}/{}", as_str(real_spec), name);
|
||||||
|
info!(context, 0, "Import: {}", path_plus_name);
|
||||||
|
let path_plus_name_c = CString::yolo(path_plus_name);
|
||||||
|
if 0 != dc_poke_eml_file(context, path_plus_name_c.as_ptr()) {
|
||||||
|
read_cnt += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ok_to_continue2 = true;
|
ok_to_continue2 = true;
|
||||||
} else {
|
|
||||||
/* import a directory */
|
|
||||||
let dir_name = std::path::Path::new(as_str(real_spec));
|
|
||||||
let dir = std::fs::read_dir(dir_name);
|
|
||||||
if dir.is_err() {
|
|
||||||
error!(
|
|
||||||
context,
|
|
||||||
0,
|
|
||||||
"Import: Cannot open directory \"{}\".",
|
|
||||||
as_str(real_spec),
|
|
||||||
);
|
|
||||||
ok_to_continue2 = false;
|
|
||||||
} else {
|
|
||||||
let dir = dir.unwrap();
|
|
||||||
for entry in dir {
|
|
||||||
if entry.is_err() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
let entry = entry.unwrap();
|
|
||||||
let name_f = entry.file_name();
|
|
||||||
let name = name_f.to_string_lossy();
|
|
||||||
if name.ends_with(".eml") {
|
|
||||||
let path_plus_name = format!("{}/{}", as_str(real_spec), name);
|
|
||||||
info!(context, 0, "Import: {}", path_plus_name);
|
|
||||||
let path_plus_name_c = CString::yolo(path_plus_name);
|
|
||||||
if 0 != dc_poke_eml_file(context, path_plus_name_c.as_ptr()) {
|
|
||||||
read_cnt += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ok_to_continue2 = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ok_to_continue2 {
|
}
|
||||||
info!(
|
if ok_to_continue2 {
|
||||||
context,
|
info!(
|
||||||
0,
|
context,
|
||||||
"Import: {} items read from \"{}\".",
|
0,
|
||||||
read_cnt,
|
"Import: {} items read from \"{}\".",
|
||||||
as_str(real_spec)
|
read_cnt,
|
||||||
);
|
as_str(real_spec)
|
||||||
if read_cnt > 0 {
|
);
|
||||||
context.call_cb(Event::MSGS_CHANGED, 0 as uintptr_t, 0 as uintptr_t);
|
if read_cnt > 0 {
|
||||||
}
|
context.call_cb(Event::MSGS_CHANGED, 0 as uintptr_t, 0 as uintptr_t);
|
||||||
success = 1
|
|
||||||
}
|
}
|
||||||
|
success = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(real_spec as *mut libc::c_void);
|
free(real_spec as *mut libc::c_void);
|
||||||
|
|||||||
Reference in New Issue
Block a user