Private
Public Access
1
0

implements sending

This commit is contained in:
2025-05-02 15:09:12 -07:00
parent f80d1a609b
commit 410182eab8
10 changed files with 135 additions and 11 deletions

View File

@@ -32,6 +32,9 @@ namespace DBusService {
[DBus (name = "GetConversations")]
public abstract GLib.HashTable<string, GLib.Variant>[] get_conversations() throws DBusError, IOError;
[DBus (name = "SyncConversationList")]
public abstract void sync_conversation_list() throws DBusError, IOError;
[DBus (name = "SyncAllConversations")]
public abstract void sync_all_conversations() throws DBusError, IOError;
@@ -41,9 +44,15 @@ namespace DBusService {
[DBus (name = "ConversationsUpdated")]
public signal void conversations_updated();
[DBus (name = "DeleteAllConversations")]
public abstract void delete_all_conversations() throws DBusError, IOError;
[DBus (name = "GetMessages")]
public abstract GLib.HashTable<string, GLib.Variant>[] get_messages(string conversation_id, string last_message_id) throws DBusError, IOError;
[DBus (name = "SendMessage")]
public abstract string send_message(string conversation_id, string text) throws DBusError, IOError;
[DBus (name = "MessagesUpdated")]
public signal void messages_updated(string conversation_id);
}

View File

@@ -24,6 +24,11 @@
</arg>
</method>
<method name="SyncConversationList">
<annotation name="org.freedesktop.DBus.DocString"
value="Initiates a background sync of the conversation list with the server."/>
</method>
<method name="SyncAllConversations">
<annotation name="org.freedesktop.DBus.DocString"
value="Initiates a background sync of all conversations with the server."/>
@@ -40,6 +45,11 @@
value="Emitted when the list of conversations is updated."/>
</signal>
<method name="DeleteAllConversations">
<annotation name="org.freedesktop.DBus.DocString"
value="Deletes all conversations from the database."/>
</method>
<!-- Messages -->
<method name="GetMessages">
@@ -48,6 +58,15 @@
<arg type="aa{sv}" direction="out" name="messages"/>
</method>
<method name="SendMessage">
<arg type="s" name="conversation_id" direction="in"/>
<arg type="s" name="text" direction="in"/>
<arg type="s" name="outgoing_message_id" direction="out"/>
<annotation name="org.freedesktop.DBus.DocString"
value="Sends a message to the server. Returns the outgoing message ID."/>
</method>
<signal name="MessagesUpdated">
<arg type="s" name="conversation_id" direction="in"/>
<annotation name="org.freedesktop.DBus.DocString"

View File

@@ -59,6 +59,14 @@ public class Repository : Object
return returned_messages;
}
public string send_message(string conversation_guid, string message) throws Error {
if (dbus_repository == null) {
throw new Error(1337, 1, "Repository not connected");
}
return dbus_repository.send_message(conversation_guid, message);
}
private async void connect_to_dbus() {
bool connected = false;