aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-14 03:27:18 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-15 15:34:12 +0100
commit16847a30c88246381a026bce9f2435be2bd77422 (patch)
treecbd5afe1282f9ec4faca5be4cff14c7e6112c807 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
parentc7acfe85c379b99c05cef98dbbab6f815b99ed83 (diff)
support for pgp files
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index babcce26..4565ce30 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -211,7 +211,7 @@ public class XmppConnectionService extends Service {
private Integer rosterChangedListenerCount = 0;
private SecureRandom mRandom;
private FileObserver fileObserver = new FileObserver(
- FileBackend.getConversationsDirectory()) {
+ FileBackend.getConversationsImageDirectory()) {
@Override
public void onEvent(int event, String path) {
@@ -311,7 +311,11 @@ public class XmppConnectionService extends Service {
if (path!=null) {
message.setRelativeFilePath(path);
getFileBackend().updateFileParams(message);
- callback.success(message);
+ if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
+ getPgpEngine().encrypt(message, callback);
+ } else {
+ callback.success(message);
+ }
} else {
new Thread(new Runnable() {
@Override
@@ -319,7 +323,11 @@ public class XmppConnectionService extends Service {
try {
getFileBackend().copyFileToPrivateStorage(message, uri);
getFileBackend().updateFileParams(message);
- callback.success(message);
+ if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
+ getPgpEngine().encrypt(message, callback);
+ } else {
+ callback.success(message);
+ }
} catch (FileBackend.FileCopyException e) {
callback.error(e.getResId(),message);
}