aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpgme-vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-01-28 20:56:27 +0100
committerfiaxh <git@mx.ax.lt>2018-01-28 22:00:22 +0100
commitf6db249c92e8fd25c1cb52872d3a647be034b626 (patch)
tree65ebb9d61fd27dcfd37a26137f507413193902d3 /plugins/gpgme-vala
parentbec810e234a7b9783eb8f35e2ffd7c60d75e09c7 (diff)
downloaddino-f6db249c92e8fd25c1cb52872d3a647be034b626.tar.gz
dino-f6db249c92e8fd25c1cb52872d3a647be034b626.zip
Only display transferred images, display file names, open in system viewer, include and use pgp embedded file names
Diffstat (limited to 'plugins/gpgme-vala')
-rw-r--r--plugins/gpgme-vala/src/gpgme_helper.vala13
-rw-r--r--plugins/gpgme-vala/vapi/gpgme.vapi6
2 files changed, 14 insertions, 5 deletions
diff --git a/plugins/gpgme-vala/src/gpgme_helper.vala b/plugins/gpgme-vala/src/gpgme_helper.vala
index cc013164..c0121842 100644
--- a/plugins/gpgme-vala/src/gpgme_helper.vala
+++ b/plugins/gpgme-vala/src/gpgme_helper.vala
@@ -19,11 +19,12 @@ public static string encrypt_armor(string plain, Key[] keys, EncryptFlags flags)
}
}
-public static uint8[] encrypt_file(string uri, Key[] keys, EncryptFlags flags) throws GLib.Error {
+public static uint8[] encrypt_file(string uri, Key[] keys, EncryptFlags flags, string file_name) throws GLib.Error {
global_mutex.lock();
try {
initialize();
Data plain_data = Data.create_from_file(uri);
+ plain_data.set_file_name(file_name);
Context context = Context.create();
context.set_armor(true);
Data enc_data = context.op_encrypt(keys, flags, plain_data);
@@ -46,14 +47,20 @@ public static string decrypt(string encr) throws GLib.Error {
}
}
-public static uint8[] decrypt_data(uint8[] data) throws GLib.Error {
+public class DecryptedData {
+ public uint8[] data { get; set; }
+ public string filename { get; set; }
+}
+
+public static DecryptedData decrypt_data(uint8[] data) throws GLib.Error {
global_mutex.lock();
try {
initialize();
Data enc_data = Data.create_from_memory(data, false);
Context context = Context.create();
Data dec_data = context.op_decrypt(enc_data);
- return get_uint8_from_data(dec_data);
+ DecryptResult* dec_res = context.op_decrypt_result();
+ return new DecryptedData() { data=get_uint8_from_data(dec_data), filename=dec_res->file_name};
} finally {
global_mutex.unlock();
}
diff --git a/plugins/gpgme-vala/vapi/gpgme.vapi b/plugins/gpgme-vala/vapi/gpgme.vapi
index 55031bfa..e66aee1f 100644
--- a/plugins/gpgme-vala/vapi/gpgme.vapi
+++ b/plugins/gpgme-vala/vapi/gpgme.vapi
@@ -59,7 +59,7 @@ namespace GPG {
string unsupported_algorithm;
bool wrong_key_usage;
Recipient recipients;
- string filename;
+ string file_name;
}
[CCode (cname = "struct _gpgme_recipient")]
@@ -481,7 +481,9 @@ namespace GPG {
public long seek(long offset, int whence=0);
- public DataEncoding *get_encoding();
+ public GPGError.Error set_file_name(string file_name);
+
+ public DataEncoding* get_encoding();
public GPGError.Error set_encoding(DataEncoding enc);
}