check for links in pgp encrypted messages as well
This commit is contained in:
parent
b7f596363b
commit
da822ebae8
|
@ -61,6 +61,10 @@ public class PgpEngine {
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
||||||
message.setBody(os.toString());
|
message.setBody(os.toString());
|
||||||
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
||||||
|
if (message.trusted() && message.bodyContainsDownloadable()) {
|
||||||
|
mXmppConnectionService.getHttpConnectionManager()
|
||||||
|
.createNewConnection(message);
|
||||||
|
}
|
||||||
callback.success(message);
|
callback.success(message);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Arrays;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class Message extends AbstractEntity {
|
public class Message extends AbstractEntity {
|
||||||
|
|
||||||
|
@ -367,13 +366,13 @@ public class Message extends AbstractEntity {
|
||||||
return prev.mergable(this);
|
return prev.mergable(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean trusted() {
|
||||||
|
Contact contact = this.getContact();
|
||||||
|
return (status > STATUS_RECEIVED || (contact != null && contact.trusted()));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean bodyContainsDownloadable() {
|
public boolean bodyContainsDownloadable() {
|
||||||
Contact contact = this.getContact();
|
|
||||||
if (status <= STATUS_RECEIVED
|
|
||||||
&& (contact == null || !contact.trusted())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
URL url = new URL(this.getBody());
|
URL url = new URL(this.getBody());
|
||||||
if (!url.getProtocol().equalsIgnoreCase("http")
|
if (!url.getProtocol().equalsIgnoreCase("http")
|
||||||
|
|
|
@ -65,6 +65,8 @@ public class HttpConnection implements Downloadable {
|
||||||
String path = mUrl.getPath();
|
String path = mUrl.getPath();
|
||||||
if (path != null && (path.endsWith(".pgp") || path.endsWith(".gpg"))) {
|
if (path != null && (path.endsWith(".pgp") || path.endsWith(".gpg"))) {
|
||||||
this.message.setEncryption(Message.ENCRYPTION_PGP);
|
this.message.setEncryption(Message.ENCRYPTION_PGP);
|
||||||
|
} else if (message.getEncryption() != Message.ENCRYPTION_OTR) {
|
||||||
|
this.message.setEncryption(Message.ENCRYPTION_NONE);
|
||||||
}
|
}
|
||||||
this.file = mXmppConnectionService.getFileBackend().getFile(
|
this.file = mXmppConnectionService.getFileBackend().getFile(
|
||||||
message, false);
|
message, false);
|
||||||
|
|
|
@ -484,7 +484,7 @@ public class MessageParser extends AbstractParser implements
|
||||||
mXmppConnectionService.databaseBackend.createMessage(message);
|
mXmppConnectionService.databaseBackend.createMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message.bodyContainsDownloadable()) {
|
if (message.trusted() && message.bodyContainsDownloadable()) {
|
||||||
this.mXmppConnectionService.getHttpConnectionManager()
|
this.mXmppConnectionService.getHttpConnectionManager()
|
||||||
.createNewConnection(message);
|
.createNewConnection(message);
|
||||||
notify = false;
|
notify = false;
|
||||||
|
|
Loading…
Reference in New Issue