[Add] when loading contacts calls are added

This commit is contained in:
Alex Emmet 2026-04-19 20:54:01 +02:00
commit 205738b32a
2 changed files with 52 additions and 42 deletions

8
Cargo.lock generated
View file

@ -3279,7 +3279,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]] [[package]]
name = "ttp-core" name = "ttp-core"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.methanium.net/Tensamin/TTP.git#01cefdf60d77b39565d662f5b585058a2b62decf" source = "git+https://git.methanium.net/Tensamin/TTP.git#4c8cacf8e8b58d917c24fa6baecefefbce2294b3"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"byteorder", "byteorder",
@ -3292,7 +3292,7 @@ dependencies = [
[[package]] [[package]]
name = "ttp-native" name = "ttp-native"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.methanium.net/Tensamin/TTP.git#01cefdf60d77b39565d662f5b585058a2b62decf" source = "git+https://git.methanium.net/Tensamin/TTP.git#4c8cacf8e8b58d917c24fa6baecefefbce2294b3"
dependencies = [ dependencies = [
"quinn", "quinn",
"rustls", "rustls",
@ -3345,9 +3345,9 @@ dependencies = [
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.19.0" version = "1.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"

View file

@ -452,7 +452,9 @@ impl GeneralConnection {
}) })
.collect() .collect()
}; };
if mapped.is_empty() {
DataValue::Array(contacts)
} else {
let mut new_contacts: Vec<DataValue> = Vec::new(); let mut new_contacts: Vec<DataValue> = Vec::new();
for contact in contacts { for contact in contacts {
if let Some(mut contact_map) = contact.as_map() { if let Some(mut contact_map) = contact.as_map() {
@ -472,12 +474,18 @@ impl GeneralConnection {
as u64 as u64
}) })
.collect(); .collect();
if filtered_mapped.is_empty() {
new_contacts.push(
DataValue::container_from_map(&contact_map),
);
continue;
}
let mut vec_of_filtered_calls: Vec<DataValue> = let mut vec_of_filtered_calls: Vec<DataValue> =
Vec::new(); Vec::new();
for (caller, call_group) in filtered_mapped { for (caller, call_group) in filtered_mapped {
vec_of_filtered_calls.push(DataValue::Container( vec_of_filtered_calls.push(
vec![ DataValue::Container(vec![
( (
DataTypes::call_id, DataTypes::call_id,
DataValue::Str( DataValue::Str(
@ -508,8 +516,8 @@ impl GeneralConnection {
.clone(), .clone(),
), ),
), ),
], ]),
)); );
} }
contact_map.insert( contact_map.insert(
@ -517,13 +525,15 @@ impl GeneralConnection {
DataValue::Array(vec_of_filtered_calls), DataValue::Array(vec_of_filtered_calls),
); );
new_contacts new_contacts.push(DataValue::container_from_map(
.push(DataValue::container_from_map(&contact_map)); &contact_map,
));
} else { } else {
new_contacts.push(contact.clone()); new_contacts.push(contact.clone());
} }
} }
DataValue::Array(new_contacts) DataValue::Array(new_contacts)
}
} else { } else {
v.clone() v.clone()
} }