Replace DC_CREATE_MVBOX with boolean

This commit is contained in:
Alexander Krotov
2019-11-28 17:45:36 +01:00
parent 6f6791c1b5
commit 430d4e5f6e
4 changed files with 8 additions and 15 deletions

View File

@@ -354,19 +354,14 @@ pub fn dc_job_do_DC_JOB_CONFIGURE_IMAP(context: &Context) {
} }
16 => { 16 => {
progress!(context, 900); progress!(context, 900);
let flags: libc::c_int = if context.get_config_bool(Config::MvboxWatch) let create_mvbox = context.get_config_bool(Config::MvboxWatch)
|| context.get_config_bool(Config::MvboxMove) || context.get_config_bool(Config::MvboxMove);
{
DC_CREATE_MVBOX as i32
} else {
0
};
context context
.inbox_thread .inbox_thread
.read() .read()
.unwrap() .unwrap()
.imap .imap
.configure_folders(context, flags); .configure_folders(context, create_mvbox);
true true
} }
17 => { 17 => {

View File

@@ -119,8 +119,6 @@ pub const DC_CONTACT_ID_INFO: u32 = 2;
pub const DC_CONTACT_ID_DEVICE: u32 = 5; pub const DC_CONTACT_ID_DEVICE: u32 = 5;
pub const DC_CONTACT_ID_LAST_SPECIAL: u32 = 9; pub const DC_CONTACT_ID_LAST_SPECIAL: u32 = 9;
pub const DC_CREATE_MVBOX: usize = 1;
// Flags for empty server job // Flags for empty server job
pub const DC_EMPTY_MVBOX: u32 = 0x01; pub const DC_EMPTY_MVBOX: u32 = 0x01;

View File

@@ -305,7 +305,7 @@ impl Imap {
.unwrap_or_default() .unwrap_or_default()
< 3 < 3
{ {
self.configure_folders(context, 0x1); self.configure_folders(context, true);
} }
return Ok(()); return Ok(());
} }
@@ -1206,7 +1206,7 @@ impl Imap {
}) })
} }
pub fn configure_folders(&self, context: &Context, flags: libc::c_int) { pub fn configure_folders(&self, context: &Context, create_mvbox: bool) {
task::block_on(async move { task::block_on(async move {
if !self.is_connected().await { if !self.is_connected().await {
return; return;
@@ -1237,7 +1237,7 @@ impl Imap {
.find(|folder| folder.name() == "DeltaChat" || folder.name() == fallback_folder) .find(|folder| folder.name() == "DeltaChat" || folder.name() == fallback_folder)
.map(|n| n.name().to_string()); .map(|n| n.name().to_string());
if mvbox_folder.is_none() && 0 != (flags as usize & DC_CREATE_MVBOX) { if mvbox_folder.is_none() && create_mvbox {
info!(context, "Creating MVBOX-folder \"DeltaChat\"...",); info!(context, "Creating MVBOX-folder \"DeltaChat\"...",);
match session.create("DeltaChat").await { match session.create("DeltaChat").await {

View File

@@ -219,7 +219,7 @@ impl Job {
.unwrap_or_default() .unwrap_or_default()
< 3 < 3
{ {
imap_inbox.configure_folders(context, 0x1i32); imap_inbox.configure_folders(context, true);
} }
let dest_folder = context let dest_folder = context
.sql .sql
@@ -346,7 +346,7 @@ impl Job {
.unwrap_or_default() .unwrap_or_default()
< 3 < 3
{ {
imap_inbox.configure_folders(context, 0x1i32); imap_inbox.configure_folders(context, true);
} }
let dest_folder = context let dest_folder = context
.sql .sql