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:
@@ -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(|props| {
|
||||
let uid = props.get("UID")?.as_str()?;
|
||||
if uid == "system-address-book" {
|
||||
// Decoy.
|
||||
return None;
|
||||
}
|
||||
|
||||
let data = props.get("Data")?.as_str()?;
|
||||
if data_contains_address_book_backend(data) {
|
||||
Some(uid.to_owned())
|
||||
@@ -199,11 +204,16 @@ impl ContactResolverBackend for EDSContactResolverBackend {
|
||||
let filter = if address.contains('@') {
|
||||
format!("(is \"email\" \"{}\")", address)
|
||||
} else {
|
||||
let mut filters: Vec<String> = Vec::new();
|
||||
filters.push(format!("(is \"phone\" \"{}\")", address));
|
||||
|
||||
let normalized_address = address
|
||||
.chars()
|
||||
.filter(|c| c.is_numeric())
|
||||
.collect::<String>();
|
||||
|
||||
filters.push(format!("(is \"phone\" \"{}\")", normalized_address));
|
||||
|
||||
let local_address = address
|
||||
.replace('+', "")
|
||||
.chars()
|
||||
@@ -213,10 +223,11 @@ impl ContactResolverBackend for EDSContactResolverBackend {
|
||||
.filter(|c| c.is_numeric())
|
||||
.collect::<String>();
|
||||
|
||||
format!(
|
||||
"(or (is \"phone\" \"{}\") (is \"phone\" \"{}\") (is \"phone\" \"{}\"))",
|
||||
address, normalized_address, local_address
|
||||
)
|
||||
if !local_address.is_empty() {
|
||||
filters.push(format!("(is \"phone\" \"{}\")", local_address));
|
||||
}
|
||||
|
||||
format!("(or {})", filters.join(" "))
|
||||
};
|
||||
|
||||
log::trace!(
|
||||
|
||||
Reference in New Issue
Block a user