mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
refactor(imap): move resync_folders() to Session
This commit is contained in:
12
src/imap.rs
12
src/imap.rs
@@ -789,29 +789,25 @@ impl Imap {
|
||||
info!(context, "Done fetching existing messages.");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Session {
|
||||
/// Synchronizes UIDs for all folders.
|
||||
pub(crate) async fn resync_folders(&mut self, context: &Context) -> Result<()> {
|
||||
self.prepare(context).await?;
|
||||
|
||||
let session = self.session.as_mut().context("No IMAP session")?;
|
||||
let all_folders = session
|
||||
let all_folders = self
|
||||
.list_folders()
|
||||
.await
|
||||
.context("listing folders for resync")?;
|
||||
for folder in all_folders {
|
||||
let folder_meaning = get_folder_meaning(&folder);
|
||||
if folder_meaning != FolderMeaning::Virtual {
|
||||
session
|
||||
.resync_folder_uids(context, folder.name(), folder_meaning)
|
||||
self.resync_folder_uids(context, folder.name(), folder_meaning)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Session {
|
||||
/// Synchronizes UIDs in the database with UIDs on the server.
|
||||
///
|
||||
/// It is assumed that no operations are taking place on the same
|
||||
|
||||
Reference in New Issue
Block a user