plumb all known attachments via dbus if known
This commit is contained in:
@@ -23,7 +23,7 @@ use uuid::Uuid;
|
||||
|
||||
use kordophone_db::{
|
||||
database::{Database, DatabaseAccess},
|
||||
models::{Conversation, Message},
|
||||
models::Conversation,
|
||||
};
|
||||
|
||||
use kordophone::api::http_client::HTTPAPIClient;
|
||||
@@ -41,8 +41,11 @@ mod post_office;
|
||||
use post_office::Event as PostOfficeEvent;
|
||||
use post_office::PostOffice;
|
||||
|
||||
mod models;
|
||||
pub use models::Attachment;
|
||||
pub use models::Message;
|
||||
|
||||
mod attachment_store;
|
||||
pub use attachment_store::Attachment;
|
||||
pub use attachment_store::AttachmentStore;
|
||||
pub use attachment_store::AttachmentStoreEvent;
|
||||
|
||||
@@ -147,8 +150,7 @@ impl Daemon {
|
||||
}
|
||||
|
||||
// Attachment store
|
||||
let data_path = Self::get_data_dir().expect("Unable to get data path");
|
||||
let mut attachment_store = AttachmentStore::new(&data_path, self.database.clone(), self.event_sender.clone());
|
||||
let mut attachment_store = AttachmentStore::new(self.database.clone(), self.event_sender.clone());
|
||||
self.attachment_store_sink = Some(attachment_store.get_event_sink());
|
||||
tokio::spawn(async move {
|
||||
attachment_store.run().await;
|
||||
@@ -270,7 +272,7 @@ impl Daemon {
|
||||
self.database
|
||||
.lock()
|
||||
.await
|
||||
.with_repository(|r| r.insert_message(&conversation_id, message))
|
||||
.with_repository(|r| r.insert_message(&conversation_id, message.into()))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -355,6 +357,7 @@ impl Daemon {
|
||||
r.get_messages_for_conversation(&conversation_id)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.map(|m| m.into()) // Convert db::Message to daemon::Message
|
||||
.chain(outgoing_messages.into_iter().map(|m| m.into()))
|
||||
.collect()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user