diff --git a/kordophoned/include/net.buzzert.kordophonecd.Server.xml b/kordophoned/include/net.buzzert.kordophonecd.Server.xml
index bdc0fb2..8e93ca5 100644
--- a/kordophoned/include/net.buzzert.kordophonecd.Server.xml
+++ b/kordophoned/include/net.buzzert.kordophonecd.Server.xml
@@ -81,10 +81,20 @@
+
+
+ value="Sends a message to the server. Returns the outgoing message ID.
+ Arguments:
+ - conversation_id: The ID of the conversation to send the message to.
+ - text: The text of the message to send.
+ - attachment_guids: The GUIDs of the attachments to send.
+
+ Returns:
+ - outgoing_message_id: The ID of the outgoing message.
+ "/>
diff --git a/kordophoned/src/daemon/attachment_store.rs b/kordophoned/src/daemon/attachment_store.rs
index b77294f..6b1c00b 100644
--- a/kordophoned/src/daemon/attachment_store.rs
+++ b/kordophoned/src/daemon/attachment_store.rs
@@ -175,7 +175,7 @@ impl AttachmentStore {
daemon_event_sink: &Sender,
) -> Result {
use tokio::fs::File;
- use tokio::io::BufReader;
+ use tokio::io::BufReader;
// Create uploads directory if it doesn't exist.
let uploads_path = store_path.join("uploads");
diff --git a/kordophoned/src/daemon/events.rs b/kordophoned/src/daemon/events.rs
index 43062fb..d14f371 100644
--- a/kordophoned/src/daemon/events.rs
+++ b/kordophoned/src/daemon/events.rs
@@ -48,8 +48,9 @@ pub enum Event {
/// Parameters:
/// - conversation_id: The ID of the conversation to send the message to.
/// - text: The text of the message to send.
+ /// - attachment_guids: The GUIDs of the attachments to send.
/// - reply: The outgoing message ID (not the server-assigned message ID).
- SendMessage(String, String, Reply),
+ SendMessage(String, String, Vec, Reply),
/// Notifies the daemon that a message has been sent.
/// Parameters:
diff --git a/kordophoned/src/daemon/mod.rs b/kordophoned/src/daemon/mod.rs
index e32e6ea..7606b90 100644
--- a/kordophoned/src/daemon/mod.rs
+++ b/kordophoned/src/daemon/mod.rs
@@ -251,10 +251,10 @@ impl Daemon {
reply.send(()).unwrap();
}
- Event::SendMessage(conversation_id, text, reply) => {
+ Event::SendMessage(conversation_id, text, attachment_guids, reply) => {
let conversation_id = conversation_id.clone();
let uuid = self
- .enqueue_outgoing_message(text, conversation_id.clone())
+ .enqueue_outgoing_message(text, conversation_id.clone(), attachment_guids)
.await;
reply.send(uuid).unwrap();
@@ -396,11 +396,12 @@ impl Daemon {
.await
}
- async fn enqueue_outgoing_message(&mut self, text: String, conversation_id: String) -> Uuid {
+ async fn enqueue_outgoing_message(&mut self, text: String, conversation_id: String, attachment_guids: Vec) -> Uuid {
let conversation_id = conversation_id.clone();
let outgoing_message = OutgoingMessage::builder()
.text(text)
.conversation_id(conversation_id.clone())
+ .file_transfer_guids(attachment_guids)
.build();
// Keep a record of this so we can provide a consistent model to the client.
diff --git a/kordophoned/src/dbus/server_impl.rs b/kordophoned/src/dbus/server_impl.rs
index 7926f99..8d9fea7 100644
--- a/kordophoned/src/dbus/server_impl.rs
+++ b/kordophoned/src/dbus/server_impl.rs
@@ -226,8 +226,9 @@ impl DbusRepository for ServerImpl {
&mut self,
conversation_id: String,
text: String,
+ attachment_guids: Vec,
) -> Result {
- self.send_event_sync(|r| Event::SendMessage(conversation_id, text, r))
+ self.send_event_sync(|r| Event::SendMessage(conversation_id, text, attachment_guids, r))
.map(|uuid| uuid.to_string())
}
diff --git a/kpcli/src/daemon/mod.rs b/kpcli/src/daemon/mod.rs
index cb4d5ff..974a7df 100644
--- a/kpcli/src/daemon/mod.rs
+++ b/kpcli/src/daemon/mod.rs
@@ -177,8 +177,9 @@ impl DaemonCli {
conversation_id: String,
text: String,
) -> Result<()> {
+ let attachment_guids: Vec<&str> = vec![];
let outgoing_message_id =
- KordophoneRepository::send_message(&self.proxy(), &conversation_id, &text)?;
+ KordophoneRepository::send_message(&self.proxy(), &conversation_id, &text, attachment_guids)?;
println!("Outgoing message ID: {}", outgoing_message_id);
Ok(())
}