Private
Public Access
1
0

plub through attachment guids via messages

This commit is contained in:
2025-05-26 16:52:38 -07:00
parent 2b5df53cc3
commit e55b29eb4d
15 changed files with 214 additions and 20 deletions

View File

@@ -128,6 +128,7 @@ impl DbusRepository for ServerImpl {
messages
.into_iter()
.map(|msg| {
let msg_id = msg.id.clone(); // Store ID for potential error logging
let mut map = arg::PropMap::new();
map.insert("id".into(), arg::Variant(Box::new(msg.id)));
map.insert("text".into(), arg::Variant(Box::new(msg.text)));
@@ -139,6 +140,31 @@ impl DbusRepository for ServerImpl {
"sender".into(),
arg::Variant(Box::new(msg.sender.display_name())),
);
// Add file transfer GUIDs if present
if !msg.file_transfer_guids.is_empty() {
match serde_json::to_string(&msg.file_transfer_guids) {
Ok(json_str) => {
map.insert("file_transfer_guids".into(), arg::Variant(Box::new(json_str)));
}
Err(e) => {
log::warn!("Failed to serialize file transfer GUIDs for message {}: {}", msg_id, e);
}
}
}
// Add attachment metadata if present
if let Some(ref attachment_metadata) = msg.attachment_metadata {
match serde_json::to_string(attachment_metadata) {
Ok(json_str) => {
map.insert("attachment_metadata".into(), arg::Variant(Box::new(json_str)));
}
Err(e) => {
log::warn!("Failed to serialize attachment metadata for message {}: {}", msg_id, e);
}
}
}
map
})
.collect()