diff --git a/src/service/interface/dbusservice.vala b/src/service/interface/dbusservice.vala
index 0cb85b6..1a6d95c 100644
--- a/src/service/interface/dbusservice.vala
+++ b/src/service/interface/dbusservice.vala
@@ -59,11 +59,17 @@ namespace DBusService {
[DBus (name = "DownloadAttachment")]
public abstract void download_attachment(string attachment_id, bool preview) throws DBusError, IOError;
+ [DBus (name = "UploadAttachment")]
+ public abstract string upload_attachment(string path) throws DBusError, IOError;
+
[DBus (name = "AttachmentDownloadCompleted")]
public signal void attachment_download_completed(string attachment_id);
[DBus (name = "AttachmentDownloadFailed")]
public signal void attachment_download_failed(string attachment_id, string error_message);
+
+ [DBus (name = "AttachmentUploadCompleted")]
+ public signal void attachment_upload_completed(string upload_guid, string attachment_guid);
}
public struct RepositoryAttachmentInfoStruct {
diff --git a/src/service/interface/xml/net.buzzert.kordophonecd.Server.xml b/src/service/interface/xml/net.buzzert.kordophonecd.Server.xml
index 2cf0e9b..bdc0fb2 100644
--- a/src/service/interface/xml/net.buzzert.kordophonecd.Server.xml
+++ b/src/service/interface/xml/net.buzzert.kordophonecd.Server.xml
@@ -120,6 +120,11 @@
"/>
+
+
+
+
+
@@ -133,6 +138,18 @@
+
+
+
+
+
+
+
diff --git a/src/service/repository.vala b/src/service/repository.vala
index f52e938..8753f6b 100644
--- a/src/service/repository.vala
+++ b/src/service/repository.vala
@@ -5,6 +5,7 @@ public class Repository : DBusServiceProxy {
public signal void conversations_updated();
public signal void messages_updated(string conversation_guid);
public signal void attachment_downloaded(string attachment_guid);
+ public signal void attachment_uploaded(string upload_guid, string attachment_guid);
public static Repository get_instance() {
if (instance == null) {
@@ -41,6 +42,10 @@ public class Repository : DBusServiceProxy {
attachment_downloaded(attachment_guid);
});
+ this.dbus_repository.attachment_upload_completed.connect((upload_guid, attachment_guid) => {
+ attachment_uploaded(upload_guid, attachment_guid);
+ });
+
conversations_updated();
} catch (GLib.Error e) {
warning("Failed to connect to repository: %s", e.message);
@@ -100,4 +105,12 @@ public class Repository : DBusServiceProxy {
dbus_repository.download_attachment(attachment_guid, preview);
}
+
+ public string upload_attachment(string filename) throws DBusServiceProxyError, GLib.Error {
+ if (dbus_repository == null) {
+ throw new DBusServiceProxyError.NOT_CONNECTED("Repository not connected");
+ }
+
+ return dbus_repository.upload_attachment(filename);
+ }
}