aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-07-13 00:20:38 +0200
committerChristian Schneppe <christian@pix-art.de>2016-07-13 18:38:07 +0200
commit4250355cebd93fc17663d5e591148bc3a48851b2 (patch)
treeae8bc160b8e3e77b5457011ab7260e72cf895524 /src/main/java/eu/siacs/conversations
parent871b3882633ac248ae4b1f884f63f815c384ee47 (diff)
call update file params from thread
now that file params has more work to do we should make sure we always call it from a sperate thread
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index df52a3b27..c0437f539 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -436,19 +436,19 @@ public class XmppConnectionService extends Service {
}
message.setCounterpart(conversation.getNextCounterpart());
message.setType(Message.TYPE_FILE);
- String path = getFileBackend().getOriginalPath(uri);
- if (path != null) {
- message.setRelativeFilePath(path);
- getFileBackend().updateFileParams(message);
- if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
- getPgpEngine().encrypt(message, callback);
- } else {
- callback.success(message);
- }
- } else {
- mFileAddingExecutor.execute(new Runnable() {
- @Override
- public void run() {
+ final String path = getFileBackend().getOriginalPath(uri);
+ mFileAddingExecutor.execute(new Runnable() {
+ @Override
+ public void run() {
+ if (path != null) {
+ message.setRelativeFilePath(path);
+ getFileBackend().updateFileParams(message);
+ if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
+ getPgpEngine().encrypt(message, callback);
+ } else {
+ callback.success(message);
+ }
+ } else {
try {
getFileBackend().copyFileToPrivateStorage(message, uri);
getFileBackend().updateFileParams(message);
@@ -456,7 +456,7 @@ public class XmppConnectionService extends Service {
final PgpEngine pgpEngine = getPgpEngine();
if (pgpEngine != null) {
pgpEngine.encrypt(message, callback);
- } else if (callback != null){
+ } else if (callback != null) {
callback.error(R.string.unable_to_connect_to_keychain, null);
}
} else {
@@ -466,8 +466,8 @@ public class XmppConnectionService extends Service {
callback.error(e.getResId(), message);
}
}
- });
- }
+ }
+ });
}
public void attachImageToConversation(final Conversation conversation, final Uri uri, final UiCallback<Message> callback) {