Private
Public Access
1
0

broken: started working on attachment dbus object, but order of endpoint creation seems to matter, need to reuse more parts

This commit is contained in:
2025-05-25 18:52:18 -07:00
parent 0d4c2e5104
commit c02d4ecdf3
5 changed files with 112 additions and 62 deletions

View File

@@ -1,11 +1,12 @@
use tokio::sync::oneshot;
use uuid::Uuid;
use kordophone_db::models::{Conversation, Message};
use kordophone::model::ConversationID;
use kordophone::model::OutgoingMessage;
use kordophone_db::models::{Conversation, Message};
use crate::daemon::settings::Settings;
use crate::daemon::Attachment;
pub type Reply<T> = oneshot::Sender<T>;
@@ -17,14 +18,14 @@ pub enum Event {
/// Asynchronous event for syncing the conversation list with the server.
SyncConversationList(Reply<()>),
/// Asynchronous event for syncing all conversations with the server.
/// Asynchronous event for syncing all conversations with the server.
SyncAllConversations(Reply<()>),
/// Asynchronous event for syncing a single conversation with the server.
SyncConversation(String, Reply<()>),
/// Returns all known conversations from the database.
/// Parameters:
/// Parameters:
/// - limit: The maximum number of conversations to return. (-1 for no limit)
/// - offset: The offset into the conversation list to start returning conversations from.
GetAllConversations(i32, i32, Reply<Vec<Conversation>>),
@@ -36,27 +37,31 @@ pub enum Event {
UpdateSettings(Settings, Reply<()>),
/// Returns all messages for a conversation from the database.
/// Parameters:
/// Parameters:
/// - conversation_id: The ID of the conversation to get messages for.
/// - last_message_id: (optional) The ID of the last message to get. If None, all messages are returned.
GetMessages(String, Option<String>, Reply<Vec<Message>>),
/// Enqueues a message to be sent to the server.
/// Parameters:
/// Parameters:
/// - conversation_id: The ID of the conversation to send the message to.
/// - text: The text of the message to send.
/// - reply: The outgoing message ID (not the server-assigned message ID).
SendMessage(String, String, Reply<Uuid>),
/// Notifies the daemon that a message has been sent.
/// Parameters:
/// Parameters:
/// - message: The message that was sent.
/// - outgoing_message: The outgoing message that was sent.
/// - conversation_id: The ID of the conversation that the message was sent to.
MessageSent(Message, OutgoingMessage, ConversationID),
/// Gets an attachment object from the attachment store.
/// Parameters:
/// - guid: The attachment guid
/// - reply: Reply of the attachment object, if known.
GetAttachment(String, Reply<Attachment>),
/// Delete all conversations from the database.
DeleteAllConversations(Reply<()>),
}