mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
revert logic to get last_seen_uid
This commit is contained in:
@@ -383,11 +383,10 @@ pub fn JobConfigureImap(context: &Context) {
|
||||
// (~30 seconds on a Moto G4 play) and might looks as if message sending is always that slow.
|
||||
e2ee::ensure_secret_key_exists(context);
|
||||
success = true;
|
||||
info!(context, "Configure completed.");
|
||||
info!(context, "key generation completed");
|
||||
progress!(context, 940);
|
||||
break; // We are done here
|
||||
}
|
||||
|
||||
_ => {
|
||||
error!(context, "Internal error: step counter out of bound",);
|
||||
break;
|
||||
@@ -410,24 +409,6 @@ pub fn JobConfigureImap(context: &Context) {
|
||||
context.smtp.clone().lock().unwrap().disconnect();
|
||||
}
|
||||
|
||||
/*
|
||||
if !success {
|
||||
// disconnect if configure did not succeed
|
||||
if imap_connected_here {
|
||||
// context.inbox.read().unwrap().disconnect(context);
|
||||
}
|
||||
if smtp_connected_here {
|
||||
// context.smtp.clone().lock().unwrap().disconnect();
|
||||
}
|
||||
} else {
|
||||
assert!(imap_connected_here && smtp_connected_here);
|
||||
info!(
|
||||
context,
|
||||
0, "Keeping IMAP/SMTP connections open after successful configuration"
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
// remember the entered parameters on success
|
||||
// and restore to last-entered on failure.
|
||||
// this way, the parameters visible to the ui are always in-sync with the current configuration.
|
||||
|
||||
14
src/imap.rs
14
src/imap.rs
@@ -587,13 +587,12 @@ impl Imap {
|
||||
);
|
||||
if let Some(ref mut session) = &mut *self.session.lock().await {
|
||||
// `FETCH <message sequence number> (UID)`
|
||||
let set = format!("{}:*", mailbox.exists);
|
||||
// note that we use fetch by sequence number
|
||||
// and thus we only need to get exactly the
|
||||
// last-index message.
|
||||
let set = format!("{}", mailbox.exists);
|
||||
match session.fetch(set, JUST_UID).await {
|
||||
Ok(list) => list
|
||||
.iter()
|
||||
.last()
|
||||
.and_then(|res| res.uid)
|
||||
.unwrap_or_default(),
|
||||
Ok(list) => list[0].uid.unwrap_or_else(|| 0),
|
||||
Err(err) => {
|
||||
bail!("fetch failed: {:?}", err);
|
||||
}
|
||||
@@ -602,7 +601,7 @@ impl Imap {
|
||||
return Err(Error::ImapNoConnection);
|
||||
}
|
||||
} else {
|
||||
mailbox.uid_next.unwrap() - 1
|
||||
max(0, mailbox.uid_next.unwrap() - 1)
|
||||
};
|
||||
|
||||
self.set_config_last_seen_uid(context, &folder, new_uid_validity, new_last_seen_uid);
|
||||
@@ -1334,6 +1333,7 @@ impl Imap {
|
||||
.set_raw_config_int(context, "folders_configured", 3)
|
||||
.ok();
|
||||
}
|
||||
info!(context, "FINISHED configuring IMAP-folders.");
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user