Add plumbing for new message/reply through core, gtk, and osx
This commit is contained in:
@@ -50,8 +50,11 @@ namespace DBusService {
|
||||
[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, string[] attachment_guids) throws DBusError, IOError;
|
||||
[DBus (name = "Reply")]
|
||||
public abstract string reply(string conversation_id, string text, string[] attachment_guids) throws DBusError, IOError;
|
||||
|
||||
[DBus (name = "NewConversation")]
|
||||
public abstract string new_conversation(string[] handle_ids, string text, string[] attachment_guids) throws DBusError, IOError;
|
||||
|
||||
[DBus (name = "MessagesUpdated")]
|
||||
public signal void messages_updated(string conversation_id);
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="SendMessage">
|
||||
<method name="Reply">
|
||||
<arg type="s" name="conversation_id" direction="in"/>
|
||||
<arg type="s" name="text" direction="in"/>
|
||||
<arg type="as" name="attachment_guids" direction="in"/>
|
||||
@@ -91,9 +91,28 @@
|
||||
<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.
|
||||
value="Replies to an existing conversation. Returns the outgoing message ID.
|
||||
Arguments:
|
||||
- conversation_id: The ID of the conversation to send the message to.
|
||||
- conversation_id: The ID of the conversation to reply 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.
|
||||
"/>
|
||||
</method>
|
||||
|
||||
<method name="NewConversation">
|
||||
<arg type="as" name="handle_ids" direction="in"/>
|
||||
<arg type="s" name="text" direction="in"/>
|
||||
<arg type="as" name="attachment_guids" direction="in"/>
|
||||
|
||||
<arg type="s" name="outgoing_message_id" direction="out"/>
|
||||
|
||||
<annotation name="org.freedesktop.DBus.DocString"
|
||||
value="Sends a message to a new conversation identified by resolved handles.
|
||||
Arguments:
|
||||
- handle_ids: The resolved handles for the new conversation.
|
||||
- text: The text of the message to send.
|
||||
- attachment_guids: The GUIDs of the attachments to send.
|
||||
|
||||
|
||||
@@ -96,12 +96,20 @@ public class Repository : DBusServiceProxy {
|
||||
return returned_messages;
|
||||
}
|
||||
|
||||
public string send_message(string conversation_guid, string message, string[] attachment_guids) throws DBusServiceProxyError, GLib.Error {
|
||||
public string reply(string conversation_guid, string message, string[] attachment_guids) throws DBusServiceProxyError, GLib.Error {
|
||||
if (dbus_repository == null) {
|
||||
throw new DBusServiceProxyError.NOT_CONNECTED("Repository not connected");
|
||||
}
|
||||
|
||||
return dbus_repository.send_message(conversation_guid, message, attachment_guids);
|
||||
return dbus_repository.reply(conversation_guid, message, attachment_guids);
|
||||
}
|
||||
|
||||
public string new_conversation(string[] handle_ids, string message, string[] attachment_guids) throws DBusServiceProxyError, GLib.Error {
|
||||
if (dbus_repository == null) {
|
||||
throw new DBusServiceProxyError.NOT_CONNECTED("Repository not connected");
|
||||
}
|
||||
|
||||
return dbus_repository.new_conversation(handle_ids, message, attachment_guids);
|
||||
}
|
||||
|
||||
public void sync_conversation(string conversation_guid) throws DBusServiceProxyError, GLib.Error {
|
||||
|
||||
@@ -257,7 +257,7 @@ class TranscriptContainerView : Adw.Bin
|
||||
}
|
||||
|
||||
try {
|
||||
Repository.get_instance().send_message(selected_conversation.guid, body, attachment_guids.to_array());
|
||||
Repository.get_instance().reply(selected_conversation.guid, body, attachment_guids.to_array());
|
||||
} catch (Error e) {
|
||||
GLib.warning("Failed to send message: %s", e.message);
|
||||
}
|
||||
@@ -333,4 +333,4 @@ class UploadedAttachment
|
||||
this.upload_guid = upload_guid;
|
||||
this.attachment_guid = attachment_guid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user