aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-19 18:36:28 +0200
committerAndreas Straub <andy@strb.org>2015-07-19 22:27:26 +0200
commit14010bf5a6198e4e53ba3f86328d061cf20b8da1 (patch)
tree160046518af40585887479d9b0821d60175b5cd6 /src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
parentec0aff4ed7982cc6db43cb6337f828f732429fd2 (diff)
Ask for key trust when sending messages
If the contact (or the own account) has keys that have UNDECIDED trust, we now drop the user into the new TrustKeysActivity, where they have to decide for each new key whether it should be TRUSTED or UNTRUSTED.
Diffstat (limited to 'src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index 39ef5d36..a2c62a8c 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -834,10 +834,19 @@ public class DatabaseBackend extends SQLiteOpenHelper {
}
public Set<IdentityKey> loadIdentityKeys(Account account, String name) {
+ return loadIdentityKeys(account, name, null);
+ }
+
+ public Set<IdentityKey> loadIdentityKeys(Account account, String name, AxolotlService.SQLiteAxolotlStore.Trust trust) {
Set<IdentityKey> identityKeys = new HashSet<>();
Cursor cursor = getIdentityKeyCursor(account, name, false);
while(cursor.moveToNext()) {
+ if ( trust != null &&
+ cursor.getInt(cursor.getColumnIndex(AxolotlService.SQLiteAxolotlStore.TRUSTED))
+ != trust.ordinal()) {
+ continue;
+ }
try {
identityKeys.add(new IdentityKey(Base64.decode(cursor.getString(cursor.getColumnIndex(AxolotlService.SQLiteAxolotlStore.KEY)),Base64.DEFAULT),0));
} catch (InvalidKeyException e) {