aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java49
1 files changed, 39 insertions, 10 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 4ff47f9e..ebc1ae83 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -35,6 +35,7 @@ import java.util.List;
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.ListItem;
@@ -363,13 +364,13 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
View view = inflater.inflate(R.layout.contact_key, keys, false);
TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type);
- ImageButton remove = (ImageButton) view
+ ImageButton removeButton = (ImageButton) view
.findViewById(R.id.button_remove);
- remove.setVisibility(View.VISIBLE);
+ removeButton.setVisibility(View.VISIBLE);
keyType.setText("OTR Fingerprint");
key.setText(CryptoHelper.prettifyFingerprint(otrFingerprint));
keys.addView(view);
- remove.setOnClickListener(new OnClickListener() {
+ removeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -384,19 +385,47 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
TextView key = (TextView) view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type);
TextView keyTrust = (TextView) view.findViewById(R.id.key_trust);
- ImageButton remove = (ImageButton) view
+ ImageButton removeButton = (ImageButton) view
.findViewById(R.id.button_remove);
- remove.setVisibility(View.VISIBLE);
- keyTrust.setVisibility(View.VISIBLE);
+ ImageButton trustButton = (ImageButton) view
+ .findViewById(R.id.button_trust);
+ final AxolotlService axolotlService = contact.getAccount().getAxolotlService();
+ final String fingerprint = identityKey.getFingerprint().replaceAll("\\s", "");
+ final Jid bareJid = contactJid.toBareJid();
+ AxolotlService.SQLiteAxolotlStore.Trust trust = contact.getAccount().getAxolotlService()
+ .getFingerprintTrust(bareJid.toString(), fingerprint);
+ switch (trust) {
+ case TRUSTED:
+ removeButton.setVisibility(View.VISIBLE);
+ //Log.d(Config.LOGTAG, AxolotlService.getLogprefix(contact.getAccount()) + "Setting remove button visible!");
+ break;
+ case UNDECIDED:
+ case UNTRUSTED:
+ //Log.d(Config.LOGTAG, AxolotlService.getLogprefix(contact.getAccount()) + "Setting trust button visible!");
+ trustButton.setVisibility(View.VISIBLE);
+ break;
+ }
keyType.setText("Axolotl Fingerprint");
key.setText(CryptoHelper.prettifyFingerprint(identityKey.getFingerprint()));
- keyTrust.setText(contact.getAccount().getAxolotlService().getFingerprintTrust(contact.getJid().toBareJid().toString(), identityKey.getFingerprint().replaceAll("\\s","")).toString());
+ keyTrust.setText(trust.toString());
+ keyTrust.setVisibility(View.VISIBLE);
keys.addView(view);
- remove.setOnClickListener(new OnClickListener() {
-
+ removeButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ axolotlService.setFingerprintTrust(bareJid.toString(), fingerprint,
+ AxolotlService.SQLiteAxolotlStore.Trust.UNTRUSTED);
+ refreshUi();
+ xmppConnectionService.updateConversationUi();
+ }
+ });
+ trustButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- //confirmToDeleteFingerprint(otrFingerprint);
+ axolotlService.setFingerprintTrust(bareJid.toString(), fingerprint,
+ AxolotlService.SQLiteAxolotlStore.Trust.TRUSTED);
+ refreshUi();
+ xmppConnectionService.updateConversationUi();
}
});
}