aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-10 03:00:40 +0200
committerAndreas Straub <andy@strb.org>2015-07-10 03:01:27 +0200
commit36e743159537c3d2a99cb45d48421cc905e83f32 (patch)
tree02ed03dcf7c9894c37ae98c37ff124017f7007a9 /src
parent7ebfe7f10853d8f6ef80aad19fd668a78c5d481c (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')
-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 92b5be96..ac770f9e 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -665,4 +665,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 dedac77e..e3767f8f 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(),