diff --git a/Cargo.lock b/Cargo.lock index dbde0f9e83..224a20b832 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1063,7 +1063,7 @@ dependencies = [ [[package]] name = "deltachat" -version = "1.50.0" +version = "1.51.0-alpha.0" dependencies = [ "ansi_term 0.12.1", "anyhow", @@ -1139,7 +1139,7 @@ dependencies = [ [[package]] name = "deltachat_ffi" -version = "1.50.0" +version = "1.51.0-alpha.0" dependencies = [ "anyhow", "async-std", diff --git a/Cargo.toml b/Cargo.toml index 0ae7a7a389..0e0a95d488 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat" -version = "1.50.0" +version = "1.51.0-alpha.0" authors = ["Delta Chat Developers (ML) "] edition = "2018" license = "MPL-2.0" diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml index 0d40122ed3..dc5a94b345 100644 --- a/deltachat-ffi/Cargo.toml +++ b/deltachat-ffi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "deltachat_ffi" -version = "1.50.0" +version = "1.51.0-alpha.0" description = "Deltachat FFI" authors = ["Delta Chat Developers (ML) "] edition = "2018" diff --git a/python/src/deltachat/chat.py b/python/src/deltachat/chat.py index 079389b300..92a002aada 100644 --- a/python/src/deltachat/chat.py +++ b/python/src/deltachat/chat.py @@ -502,18 +502,23 @@ def get_locations(self, contact=None, timestamp_from=None, timestamp_to=None): latitude=lib.dc_array_get_latitude(dc_array, i), longitude=lib.dc_array_get_longitude(dc_array, i), accuracy=lib.dc_array_get_accuracy(dc_array, i), - timestamp=datetime.utcfromtimestamp(lib.dc_array_get_timestamp(dc_array, i))) + timestamp=datetime.utcfromtimestamp( + lib.dc_array_get_timestamp(dc_array, i) + ), + marker=from_dc_charpointer(lib.dc_array_get_marker(dc_array, i)), + ) for i in range(lib.dc_array_get_cnt(dc_array)) ] class Location: - def __init__(self, latitude, longitude, accuracy, timestamp): + def __init__(self, latitude, longitude, accuracy, timestamp, marker): assert isinstance(timestamp, datetime) self.latitude = latitude self.longitude = longitude self.accuracy = accuracy self.timestamp = timestamp + self.marker = marker def __eq__(self, other): return self.__dict__ == other.__dict__ diff --git a/python/src/deltachat/testplugin.py b/python/src/deltachat/testplugin.py index d0fa1250ee..29f21bcdd1 100644 --- a/python/src/deltachat/testplugin.py +++ b/python/src/deltachat/testplugin.py @@ -312,19 +312,19 @@ def get_online_configuring_account(self, mvbox=False, sentbox=False, move=False, def get_one_online_account(self, pre_generated_key=True, mvbox=False, move=False): ac1 = self.get_online_configuring_account( pre_generated_key=pre_generated_key, mvbox=mvbox, move=move) - self.wait_configure_and_start_io() + self.wait_configure_and_start_io([ac1]) return ac1 def get_two_online_accounts(self, move=False, quiet=False): ac1 = self.get_online_configuring_account(move=move, quiet=quiet) ac2 = self.get_online_configuring_account(quiet=quiet) - self.wait_configure_and_start_io() + self.wait_configure_and_start_io([ac1, ac2]) return ac1, ac2 def get_many_online_accounts(self, num, move=True): accounts = [self.get_online_configuring_account(move=move, quiet=True) for i in range(num)] - self.wait_configure_and_start_io() + self.wait_configure_and_start_io(accounts) for acc in accounts: acc.add_account_plugin(FFIEventLogger(acc)) return accounts @@ -356,16 +356,19 @@ def clone_online_account(self, account, pre_generated_key=True): ac._configtracker = ac.configure() return ac - def wait_configure_and_start_io(self): + def wait_configure_and_start_io(self, accounts=None): + if accounts is None: + accounts = self._accounts[:] started_accounts = [] - for acc in self._accounts: - self.wait_configure(acc) - acc.set_config("bcc_self", "0") - if acc.is_configured() and acc not in started_accounts: - acc.start_io() - started_accounts.append(acc) - print("{}: {} account was successfully setup".format( - acc.get_config("displayname"), acc.get_config("addr"))) + for acc in accounts: + if acc not in started_accounts: + self.wait_configure(acc) + acc.set_config("bcc_self", "0") + if acc.is_configured(): + acc.start_io() + started_accounts.append(acc) + print("{}: {} account was started".format( + acc.get_config("displayname"), acc.get_config("addr"))) for acc in started_accounts: acc._evtracker.wait_all_initial_fetches() diff --git a/python/tests/test_account.py b/python/tests/test_account.py index 225520bd82..b643e6b771 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -1876,7 +1876,7 @@ def test_send_receive_locations(self, acfactory, lp): ac1.set_location(latitude=2.0, longitude=3.0, accuracy=0.5) ac1._evtracker.get_matching("DC_EVENT_LOCATION_CHANGED") - chat1.send_text("hello") + chat1.send_text("🍞") ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT") lp.sec("ac2: wait for incoming location message") @@ -1890,6 +1890,7 @@ def test_send_receive_locations(self, acfactory, lp): assert locations[0].longitude == 3.0 assert locations[0].accuracy == 0.5 assert locations[0].timestamp > now + assert locations[0].marker == "🍞" contact = ac2.create_contact(ac1) locations2 = chat2.get_locations(contact=contact) diff --git a/src/imap/scan_folders.rs b/src/imap/scan_folders.rs index 0d04b935ef..708617fc8c 100644 --- a/src/imap/scan_folders.rs +++ b/src/imap/scan_folders.rs @@ -30,6 +30,7 @@ impl Imap { let session = self.session.as_mut(); let session = session.context("scan_folders(): IMAP No Connection established")?; let folders: Vec<_> = session.list(Some(""), Some("*")).await?.collect().await; + let watched_folders = get_watched_folders(context).await; let mut sentbox_folder = None; let mut spam_folder = None; @@ -42,7 +43,15 @@ impl Imap { continue; } }; + let foldername = folder.name(); + if watched_folders.contains(&foldername.to_string()) { + info!( + context, + "Not scanning folder {} as it is watched anyway", foldername + ); + continue; + } info!(context, "Scanning folder: {}", foldername); let folder_meaning = get_folder_meaning(&folder); @@ -78,3 +87,20 @@ impl Imap { Ok(()) } } + +async fn get_watched_folders(context: &Context) -> Vec { + let mut res = Vec::new(); + let folder_watched_configured = &[ + (Config::SentboxWatch, Config::ConfiguredSentboxFolder), + (Config::MvboxWatch, Config::ConfiguredMvboxFolder), + (Config::InboxWatch, Config::ConfiguredInboxFolder), + ]; + for (watched, configured) in folder_watched_configured { + if context.get_config_bool(*watched).await { + if let Some(folder) = context.get_config(*configured).await { + res.push(folder); + } + } + } + res +}