aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-27 11:00:03 +0100
committeriNPUTmice <daniel@gultsch.de>2014-10-27 11:00:03 +0100
commitda822ebae89ad3b010a58cdf3b812d26de4b2aa4 (patch)
tree2c1e6302c2c869fc5d53aa154fcfbb643265843a /src
parentb7f596363b67d7c62b5034aedc5548f97ca68569 (diff)
check for links in pgp encrypted messages as well
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/crypto/PgpEngine.java4
-rw-r--r--src/eu/siacs/conversations/entities/Message.java11
-rw-r--r--src/eu/siacs/conversations/http/HttpConnection.java2
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java2
4 files changed, 12 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java
index c3935ff5..f1a698db 100644
--- a/src/eu/siacs/conversations/crypto/PgpEngine.java
+++ b/src/eu/siacs/conversations/crypto/PgpEngine.java
@@ -61,6 +61,10 @@ public class PgpEngine {
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
message.setBody(os.toString());
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ if (message.trusted() && message.bodyContainsDownloadable()) {
+ mXmppConnectionService.getHttpConnectionManager()
+ .createNewConnection(message);
+ }
callback.success(message);
}
} catch (IOException e) {
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java
index 79b9b5ba..a089dd64 100644
--- a/src/eu/siacs/conversations/entities/Message.java
+++ b/src/eu/siacs/conversations/entities/Message.java
@@ -7,7 +7,6 @@ import java.util.Arrays;
import eu.siacs.conversations.Config;
import android.content.ContentValues;
import android.database.Cursor;
-import android.util.Log;
public class Message extends AbstractEntity {
@@ -367,13 +366,13 @@ public class Message extends AbstractEntity {
return prev.mergable(this);
}
}
+
+ public boolean trusted() {
+ Contact contact = this.getContact();
+ return (status > STATUS_RECEIVED || (contact != null && contact.trusted()));
+ }
public boolean bodyContainsDownloadable() {
- Contact contact = this.getContact();
- if (status <= STATUS_RECEIVED
- && (contact == null || !contact.trusted())) {
- return false;
- }
try {
URL url = new URL(this.getBody());
if (!url.getProtocol().equalsIgnoreCase("http")
diff --git a/src/eu/siacs/conversations/http/HttpConnection.java b/src/eu/siacs/conversations/http/HttpConnection.java
index 29837880..0810e167 100644
--- a/src/eu/siacs/conversations/http/HttpConnection.java
+++ b/src/eu/siacs/conversations/http/HttpConnection.java
@@ -65,6 +65,8 @@ public class HttpConnection implements Downloadable {
String path = mUrl.getPath();
if (path != null && (path.endsWith(".pgp") || path.endsWith(".gpg"))) {
this.message.setEncryption(Message.ENCRYPTION_PGP);
+ } else if (message.getEncryption() != Message.ENCRYPTION_OTR) {
+ this.message.setEncryption(Message.ENCRYPTION_NONE);
}
this.file = mXmppConnectionService.getFileBackend().getFile(
message, false);
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 26841f43..1d80ec5c 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -484,7 +484,7 @@ public class MessageParser extends AbstractParser implements
mXmppConnectionService.databaseBackend.createMessage(message);
}
}
- if (message.bodyContainsDownloadable()) {
+ if (message.trusted() && message.bodyContainsDownloadable()) {
this.mXmppConnectionService.getHttpConnectionManager()
.createNewConnection(message);
notify = false;