melib/imap: check for max uid == 0 when resyncing
parent
64a2af3777
commit
e8f3b6aa24
|
@ -539,7 +539,7 @@ mod sqlite3_m {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tx.commit()?;
|
tx.commit()?;
|
||||||
let new_max_uid = self.max_uid(mailbox_hash)?;
|
let new_max_uid = self.max_uid(mailbox_hash).unwrap_or(0);
|
||||||
self.uid_store
|
self.uid_store
|
||||||
.max_uids
|
.max_uids
|
||||||
.lock()
|
.lock()
|
||||||
|
|
|
@ -261,8 +261,12 @@ impl ImapConnection {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.insert_existing_set(payload.iter().map(|(_, env)| env.hash()).collect::<_>());
|
.insert_existing_set(payload.iter().map(|(_, env)| env.hash()).collect::<_>());
|
||||||
// 3. tag2 UID FETCH 1:<lastseenuid> FLAGS
|
// 3. tag2 UID FETCH 1:<lastseenuid> FLAGS
|
||||||
self.send_command(format!("UID FETCH 1:{} FLAGS", max_uid).as_bytes())
|
if max_uid == 0 {
|
||||||
.await?;
|
self.send_command("UID FETCH 1:* FLAGS".as_bytes()).await?;
|
||||||
|
} else {
|
||||||
|
self.send_command(format!("UID FETCH 1:{} FLAGS", max_uid).as_bytes())
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
self.read_response(&mut response, RequiredResponses::FETCH_REQUIRED)
|
self.read_response(&mut response, RequiredResponses::FETCH_REQUIRED)
|
||||||
.await?;
|
.await?;
|
||||||
//1) update cached flags for old messages;
|
//1) update cached flags for old messages;
|
||||||
|
@ -539,14 +543,25 @@ impl ImapConnection {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.insert_existing_set(payload.iter().map(|(_, env)| env.hash()).collect::<_>());
|
.insert_existing_set(payload.iter().map(|(_, env)| env.hash()).collect::<_>());
|
||||||
// 3. tag2 UID FETCH 1:<lastseenuid> FLAGS
|
// 3. tag2 UID FETCH 1:<lastseenuid> FLAGS
|
||||||
self.send_command(
|
if cached_max_uid == 0 {
|
||||||
format!(
|
self.send_command(
|
||||||
"UID FETCH 1:{} FLAGS (CHANGEDSINCE {})",
|
format!(
|
||||||
cached_max_uid, cached_highestmodseq
|
"UID FETCH 1:* FLAGS (CHANGEDSINCE {})",
|
||||||
|
cached_highestmodseq
|
||||||
|
)
|
||||||
|
.as_bytes(),
|
||||||
)
|
)
|
||||||
.as_bytes(),
|
.await?;
|
||||||
)
|
} else {
|
||||||
.await?;
|
self.send_command(
|
||||||
|
format!(
|
||||||
|
"UID FETCH 1:{} FLAGS (CHANGEDSINCE {})",
|
||||||
|
cached_max_uid, cached_highestmodseq
|
||||||
|
)
|
||||||
|
.as_bytes(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
self.read_response(&mut response, RequiredResponses::FETCH_REQUIRED)
|
self.read_response(&mut response, RequiredResponses::FETCH_REQUIRED)
|
||||||
.await?;
|
.await?;
|
||||||
//1) update cached flags for old messages;
|
//1) update cached flags for old messages;
|
||||||
|
|
Loading…
Reference in New Issue