Private
Public Access
1
0

EDS: Found the issue where address book sometimes doesn't load -v

The wrong source was getting selected. Not sure if this one is always a
decoy, there might be others that we aren't supposed to use. Happy that
it's working now though.
This commit is contained in:
2025-06-27 00:48:20 -07:00
parent b043ff6f08
commit 6e14585a12

View File

@@ -114,6 +114,11 @@ fn ensure_address_book_uid(conn: &Connection) -> anyhow::Result<String> {
.filter_map(|ifaces| ifaces.get("org.gnome.evolution.dataserver.Source")) .filter_map(|ifaces| ifaces.get("org.gnome.evolution.dataserver.Source"))
.filter_map(|props| { .filter_map(|props| {
let uid = props.get("UID")?.as_str()?; let uid = props.get("UID")?.as_str()?;
if uid == "system-address-book" {
// Decoy.
return None;
}
let data = props.get("Data")?.as_str()?; let data = props.get("Data")?.as_str()?;
if data_contains_address_book_backend(data) { if data_contains_address_book_backend(data) {
Some(uid.to_owned()) Some(uid.to_owned())
@@ -199,11 +204,16 @@ impl ContactResolverBackend for EDSContactResolverBackend {
let filter = if address.contains('@') { let filter = if address.contains('@') {
format!("(is \"email\" \"{}\")", address) format!("(is \"email\" \"{}\")", address)
} else { } else {
let mut filters: Vec<String> = Vec::new();
filters.push(format!("(is \"phone\" \"{}\")", address));
let normalized_address = address let normalized_address = address
.chars() .chars()
.filter(|c| c.is_numeric()) .filter(|c| c.is_numeric())
.collect::<String>(); .collect::<String>();
filters.push(format!("(is \"phone\" \"{}\")", normalized_address));
let local_address = address let local_address = address
.replace('+', "") .replace('+', "")
.chars() .chars()
@@ -213,10 +223,11 @@ impl ContactResolverBackend for EDSContactResolverBackend {
.filter(|c| c.is_numeric()) .filter(|c| c.is_numeric())
.collect::<String>(); .collect::<String>();
format!( if !local_address.is_empty() {
"(or (is \"phone\" \"{}\") (is \"phone\" \"{}\") (is \"phone\" \"{}\"))", filters.push(format!("(is \"phone\" \"{}\")", local_address));
address, normalized_address, local_address }
)
format!("(or {})", filters.join(" "))
}; };
log::trace!( log::trace!(