mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 05:46:29 +03:00
imap: add info events when fetching existing messages
This commit is contained in:
@@ -228,14 +228,26 @@ def test_fetch_existing(acfactory, lp, mvbox_move):
|
||||
assert_folders_configured(ac1_clone)
|
||||
|
||||
lp.sec("check that ac2 contact was fetchted during configure")
|
||||
for ev in ac1_clone._evtracker.iter_events():
|
||||
if ev.name == "DC_EVENT_INFO" and "Started fetching existing contacts." in ev.data2:
|
||||
break
|
||||
ac1_clone._evtracker.get_matching("DC_EVENT_CONTACTS_CHANGED")
|
||||
ac2_addr = ac2.get_config("addr")
|
||||
assert any(c.addr == ac2_addr for c in ac1_clone.get_contacts())
|
||||
for ev in ac1_clone._evtracker.iter_events():
|
||||
if ev.name == "DC_EVENT_INFO" and "Done fetching existing contacts." in ev.data2:
|
||||
break
|
||||
assert_folders_configured(ac1_clone)
|
||||
|
||||
lp.sec("check that messages changed events arrive for the correct message")
|
||||
for ev in ac1_clone._evtracker.iter_events():
|
||||
if ev.name == "DC_EVENT_INFO" and "Started fetching existing messages." in ev.data2:
|
||||
break
|
||||
msg = ac1_clone._evtracker.wait_next_messages_changed()
|
||||
assert msg.text == "message text"
|
||||
for ev in ac1_clone._evtracker.iter_events():
|
||||
if ev.name == "DC_EVENT_INFO" and "Done fetching existing messages." in ev.data2:
|
||||
break
|
||||
assert_folders_configured(ac1)
|
||||
assert_folders_configured(ac1_clone)
|
||||
|
||||
|
||||
@@ -919,11 +919,14 @@ impl Imap {
|
||||
}
|
||||
self.prepare(context).await.context("could not connect")?;
|
||||
|
||||
info!(context, "Started fetching existing contacts.");
|
||||
add_all_recipients_as_contacts(context, self, Config::ConfiguredSentboxFolder).await?;
|
||||
add_all_recipients_as_contacts(context, self, Config::ConfiguredMvboxFolder).await?;
|
||||
add_all_recipients_as_contacts(context, self, Config::ConfiguredInboxFolder).await?;
|
||||
info!(context, "Done fetching existing contacts.");
|
||||
|
||||
if context.get_config_bool(Config::FetchExistingMsgs).await? {
|
||||
info!(context, "Started fetching existing messages.");
|
||||
for config in &[
|
||||
Config::ConfiguredMvboxFolder,
|
||||
Config::ConfiguredInboxFolder,
|
||||
@@ -935,9 +938,11 @@ impl Imap {
|
||||
.context("could not fetch messages")?;
|
||||
}
|
||||
}
|
||||
info!(context, "Done fetching existing messages.");
|
||||
} else {
|
||||
info!(context, "Not fetching existing messages.");
|
||||
}
|
||||
|
||||
info!(context, "Done fetching existing messages.");
|
||||
context
|
||||
.set_config_bool(Config::FetchedExistingMsgs, true)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user