aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-10 03:00:40 +0200
committerAndreas Straub <andy@strb.org>2015-07-19 22:23:27 +0200
commit9e8d9a64012531be8f6f72835c6f879d2a4451a1 (patch)
tree12255eaa0bd894f251bcd6dc246cd1fadef359ef /src/main
parent3d339460889644c859d932eb3f2e324bd5696707 (diff)
Show trust status of messages' originating session
Shade lock icon red if message was received in a session that has not been marked trusted by the user or fingerprint is unknown
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java13
2 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index 9695e6fa..ac6c6625 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -675,4 +675,8 @@ public class Message extends AbstractEntity {
public void setAxolotlFingerprint(String fingerprint) {
this.axolotlFingerprint = fingerprint;
}
+
+ public String getAxolotlFingerprint() {
+ return axolotlFingerprint;
+ }
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 167f3f02..d2c75a5e 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -3,6 +3,7 @@ package eu.siacs.conversations.ui.adapter;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.graphics.Color;
import android.graphics.Typeface;
import android.net.Uri;
import android.text.Spannable;
@@ -26,6 +27,7 @@ import android.widget.Toast;
import java.util.List;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
@@ -154,6 +156,17 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.indicator.setVisibility(View.GONE);
} else {
viewHolder.indicator.setVisibility(View.VISIBLE);
+ if (message.getMergedStatus() == Message.STATUS_RECEIVED
+ && message.getEncryption() == Message.ENCRYPTION_AXOLOTL) {
+ AxolotlService.SQLiteAxolotlStore.Trust trust = message.getConversation()
+ .getAccount().getAxolotlService().getFingerprintTrust(
+ message.getContact().getJid().toBareJid().toString(),
+ message.getAxolotlFingerprint());
+
+ if (trust == null || trust != AxolotlService.SQLiteAxolotlStore.Trust.TRUSTED) {
+ viewHolder.indicator.setColorFilter(Color.RED);
+ }
+ }
}
String formatedTime = UIHelper.readableTimeDifferenceFull(getContext(),