rename option 'Prefetch' to 'FetchExisting' and limit it to that

This commit is contained in:
B. Petersen
2020-10-16 15:03:11 +02:00
committed by holger krekel
parent aa26c52813
commit 0a300da347
4 changed files with 22 additions and 20 deletions

View File

@@ -350,7 +350,9 @@ char* dc_get_blobdir (const dc_context_t* context);
* The type `jitsi:` may be handled by external apps. * The type `jitsi:` may be handled by external apps.
* If no type is prefixed, the videochat is handled completely in a browser. * If no type is prefixed, the videochat is handled completely in a browser.
* - `bot` = Set to "1" if this is a bot. E.g. prevents adding the "Device messages" and "Saved messages" chats. * - `bot` = Set to "1" if this is a bot. E.g. prevents adding the "Device messages" and "Saved messages" chats.
* - `prefetch` = 1=fetch most recent existing messages on configure (default), 0=do not fetch on configure * - `fetch_existing` = 1=fetch most recent existing messages on configure (default),
* 0=do not fetch existing messages on configure.
* In both cases, existing recipients are added to the contact database.
* *
* If you want to retrieve a value, use dc_get_config(). * If you want to retrieve a value, use dc_get_config().
* *

View File

@@ -70,7 +70,7 @@ pub enum Config {
MediaQuality, MediaQuality,
#[strum(props(default = "1"))] #[strum(props(default = "1"))]
Prefetch, FetchExisting,
#[strum(props(default = "0"))] #[strum(props(default = "0"))]
KeyGenType, KeyGenType,

View File

@@ -353,13 +353,11 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
e2ee::ensure_secret_key_exists(ctx).await?; e2ee::ensure_secret_key_exists(ctx).await?;
info!(ctx, "key generation completed"); info!(ctx, "key generation completed");
if ctx.get_config_bool(Config::Prefetch).await { job::add(
job::add( ctx,
ctx, job::Job::new(Action::FetchExistingMsgs, 0, Params::new(), 0),
job::Job::new(Action::FetchExistingMsgs, 0, Params::new(), 0), )
) .await;
.await;
}
progress!(ctx, 940); progress!(ctx, 940);
update_device_chats_handle.await?; update_device_chats_handle.await?;

View File

@@ -636,17 +636,19 @@ impl Job {
add_all_recipients_as_contacts(context, imap, Config::ConfiguredMvboxFolder).await; add_all_recipients_as_contacts(context, imap, Config::ConfiguredMvboxFolder).await;
add_all_recipients_as_contacts(context, imap, Config::ConfiguredInboxFolder).await; add_all_recipients_as_contacts(context, imap, Config::ConfiguredInboxFolder).await;
for config in &[ if context.get_config_bool(Config::FetchExisting).await {
Config::ConfiguredMvboxFolder, for config in &[
Config::ConfiguredInboxFolder, Config::ConfiguredMvboxFolder,
Config::ConfiguredSentboxFolder, Config::ConfiguredInboxFolder,
] { Config::ConfiguredSentboxFolder,
if let Some(folder) = context.get_config(*config).await { ] {
if let Err(e) = imap.fetch_new_messages(context, folder, true).await { if let Some(folder) = context.get_config(*config).await {
// We are using Anyhow's .context() and to show the inner error, too, we need the {:#}: if let Err(e) = imap.fetch_new_messages(context, folder, true).await {
warn!(context, "Could not fetch messages, retrying: {:#}", e); // We are using Anyhow's .context() and to show the inner error, too, we need the {:#}:
return Status::RetryLater; warn!(context, "Could not fetch messages, retrying: {:#}", e);
}; return Status::RetryLater;
};
}
} }
} }
info!(context, "Done fetching existing messages."); info!(context, "Done fetching existing messages.");