aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/crypto
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-06-29 15:38:16 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-06-29 15:38:16 +0200
commit0030bbf472910c3ce421c3ba90d91b8c5f00102b (patch)
treecabe0edddfaa222aa61bb32c9ca625fbb8dc4945 /src/main/java/eu/siacs/conversations/crypto
parentfdd46f1c913e9ca7e23643ed58b67900d7659a5d (diff)
untested pgp support for http upload
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/PgpEngine.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
index ad5a41323..ca255cfcc 100644
--- a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
+++ b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
@@ -143,11 +143,15 @@ public class PgpEngine {
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message
.getConversation().getAccount().getJid().toBareJid().toString());
- if (message.getType() == Message.TYPE_TEXT) {
+ if (!message.needsUploading()) {
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
-
- InputStream is = new ByteArrayInputStream(message.getBody()
- .getBytes());
+ String body;
+ if (message.hasFileOnRemoteHost()) {
+ body = message.getImageParams().url.toString();
+ } else {
+ body = message.getBody();
+ }
+ InputStream is = new ByteArrayInputStream(body.getBytes());
final OutputStream os = new ByteArrayOutputStream();
api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
@@ -184,7 +188,7 @@ public class PgpEngine {
}
}
});
- } else if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE) {
+ } else {
try {
DownloadableFile inputFile = this.mXmppConnectionService
.getFileBackend().getFile(message, true);