aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parentbca29cf7fd6fcf7438f39d81833cda18a94eefd9 (diff)
indicate cbe in chat message hint
Diffstat (limited to '')
-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
-rw-r--r--src/main/res/values/strings.xml5
3 files changed, 26 insertions, 3 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));
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index e3dfb79d..fa484a82 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -82,6 +82,7 @@
<string name="send_unencrypted_message">Send unencrypted message</string>
<string name="send_otr_message">Send OTR encrypted message</string>
<string name="send_omemo_message">Send OMEMO encrypted message</string>
+ <string name="send_omemo_x509_message">Send OMEMO (X.509 verified) encrypted message</string>
<string name="send_pgp_message">Send OpenPGP encrypted message</string>
<string name="your_nick_has_been_changed">Your nickname has been changed</string>
<string name="send_unencrypted">Send unencrypted</string>
@@ -211,9 +212,9 @@
<string name="your_fingerprint">Your fingerprint</string>
<string name="otr_fingerprint">OTR fingerprint</string>
<string name="omemo_fingerprint">OMEMO fingerprint</string>
- <string name="omemo_fingerprint_x509">OMEMO fingerprint (X509 verified)</string>
+ <string name="omemo_fingerprint_x509">OMEMO fingerprint (X.509 verified)</string>
<string name="omemo_fingerprint_selected_message">OMEMO fingerprint of message</string>
- <string name="omemo_fingerprint_x509_selected_message">OMEMO fingerprint (X509 verified) of message</string>
+ <string name="omemo_fingerprint_x509_selected_message">OMEMO fingerprint (X.509 verified) of message</string>
<string name="this_device_omemo_fingerprint">Own OMEMO fingerprint</string>
<string name="other_devices">Other devices</string>
<string name="trust_omemo_fingerprints">Trust OMEMO Fingerprints</string>