indicate cbe in chat message hint

This commit is contained in:
Daniel Gultsch 2015-10-31 22:55:04 +01:00
parent bca29cf7fd
commit baf76d883c
3 changed files with 26 additions and 3 deletions

View File

@ -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);

View File

@ -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:
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));

View File

@ -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>