aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-10-31 22:55:04 +0100
committerDaniel Gultsch <daniel@gultsch.de>2015-10-31 22:55:04 +0100
commitbaf76d883cd513251445c31680dc9847d6fa3877 (patch)
tree003563a2af56367aa199bb21590d16fdcae989ac /src/main/java/eu
parentbca29cf7fd6fcf7438f39d81833cda18a94eefd9 (diff)
indicate cbe in chat message hint
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java16
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java8
2 files changed, 23 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
index 8cda3c12..2aaadab7 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
@@ -778,6 +778,22 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
return newSessions;
}
+ public boolean trustedSessionVerified(final Conversation conversation) {
+ Set<XmppAxolotlSession> sessions = findSessionsforContact(conversation.getContact());
+ sessions.addAll(findOwnSessions());
+ boolean verified = false;
+ for(XmppAxolotlSession session : sessions) {
+ if (session.getTrust().trusted()) {
+ if (session.getTrust() == XmppAxolotlSession.Trust.TRUSTED_X509) {
+ verified = true;
+ } else {
+ return false;
+ }
+ }
+ }
+ return verified;
+ }
+
public boolean hasPendingKeyFetches(Account account, Contact contact) {
AxolotlAddress ownAddress = new AxolotlAddress(account.getJid().toBareJid().toString(), 0);
AxolotlAddress foreignAddress = new AxolotlAddress(contact.getJid().toBareJid().toString(), 0);
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 7b83c2be..f7a0e210 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -46,6 +46,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
+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;
@@ -363,7 +364,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
mEditMessage.setHint(getString(R.string.send_otr_message));
break;
case Message.ENCRYPTION_AXOLOTL:
- mEditMessage.setHint(getString(R.string.send_omemo_message));
+ AxolotlService axolotlService = conversation.getAccount().getAxolotlService();
+ if (axolotlService.trustedSessionVerified(conversation)) {
+ mEditMessage.setHint(getString(R.string.send_omemo_x509_message));
+ } else {
+ mEditMessage.setHint(getString(R.string.send_omemo_message));
+ }
break;
case Message.ENCRYPTION_PGP:
mEditMessage.setHint(getString(R.string.send_pgp_message));