mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 06:46:35 +03:00
revert logic to get last_seen_uid
This commit is contained in:
committed by
Floris Bruynooghe
parent
8f43d7fa34
commit
7be5fe925a
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