aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/crypto/PgpEngine.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java
index f1a698db..9a2b4a11 100644
--- a/src/eu/siacs/conversations/crypto/PgpEngine.java
+++ b/src/eu/siacs/conversations/crypto/PgpEngine.java
@@ -10,12 +10,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
-import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpApi.IOpenPgpCallback;
-import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
@@ -27,7 +25,7 @@ import eu.siacs.conversations.ui.UiCallback;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.BitmapFactory;
-import android.util.Log;
+import android.net.Uri;
public class PgpEngine {
private OpenPgpApi api;
@@ -40,7 +38,6 @@ public class PgpEngine {
public void decrypt(final Message message,
final UiCallback<Message> callback) {
- Log.d(Config.LOGTAG, "decrypting message " + message.getUuid());
Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message
@@ -79,10 +76,6 @@ public class PgpEngine {
message);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
- OpenPgpError error = result
- .getParcelableExtra(OpenPgpApi.RESULT_ERROR);
- Log.d(Config.LOGTAG,
- "openpgp error: " + error.getMessage());
callback.error(R.string.openpgp_error, message);
return;
default:
@@ -128,7 +121,10 @@ public class PgpEngine {
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
PgpEngine.this.mXmppConnectionService
.updateMessage(message);
- ;
+ inputFile.delete();
+ Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
+ intent.setData(Uri.fromFile(outputFile));
+ mXmppConnectionService.sendBroadcast(intent);
callback.success(message);
return;
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
@@ -242,9 +238,11 @@ public class PgpEngine {
}
});
} catch (FileNotFoundException e) {
- Log.d(Config.LOGTAG, "file not found: " + e.getMessage());
+ callback.error(R.string.openpgp_error, message);
+ return;
} catch (IOException e) {
- Log.d(Config.LOGTAG, "io exception during file encrypt");
+ callback.error(R.string.openpgp_error, message);
+ return;
}
}
}
@@ -288,11 +286,6 @@ public class PgpEngine {
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED:
return 0;
case OpenPgpApi.RESULT_CODE_ERROR:
- Log.d(Config.LOGTAG,
- "openpgp error: "
- + ((OpenPgpError) result
- .getParcelableExtra(OpenPgpApi.RESULT_ERROR))
- .getMessage());
return 0;
}
return 0;