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 => {
progress!(context, 900);
let flags: libc::c_int = if context.get_config_bool(Config::MvboxWatch)
|| context.get_config_bool(Config::MvboxMove)
{
DC_CREATE_MVBOX as i32
} else {
0
};
let create_mvbox = context.get_config_bool(Config::MvboxWatch)
|| context.get_config_bool(Config::MvboxMove);
context
.inbox_thread
.read()
.unwrap()
.imap
.configure_folders(context, flags);
.configure_folders(context, create_mvbox);
true
}
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_LAST_SPECIAL: u32 = 9;
pub const DC_CREATE_MVBOX: usize = 1;
// Flags for empty server job
pub const DC_EMPTY_MVBOX: u32 = 0x01;

View File

@@ -305,7 +305,7 @@ impl Imap {
.unwrap_or_default()
< 3
{
self.configure_folders(context, 0x1);
self.configure_folders(context, true);
}
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 {
if !self.is_connected().await {
return;
@@ -1237,7 +1237,7 @@ impl Imap {
.find(|folder| folder.name() == "DeltaChat" || folder.name() == fallback_folder)
.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\"...",);
match session.create("DeltaChat").await {

View File

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