save otr fingerprint in message
This commit is contained in:
parent
867d0ef191
commit
e074104004
|
@ -773,11 +773,11 @@ public class Message extends AbstractEntity {
|
|||
public int height = 0;
|
||||
}
|
||||
|
||||
public void setAxolotlFingerprint(String fingerprint) {
|
||||
public void setFingerprint(String fingerprint) {
|
||||
this.axolotlFingerprint = fingerprint;
|
||||
}
|
||||
|
||||
public String getAxolotlFingerprint() {
|
||||
public String getFingerprint() {
|
||||
return axolotlFingerprint;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ import android.util.Pair;
|
|||
import net.java.otr4j.session.Session;
|
||||
import net.java.otr4j.session.SessionStatus;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.crypto.OtrService;
|
||||
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
||||
import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
|
@ -95,8 +95,11 @@ public class MessageParser extends AbstractParser implements
|
|||
conversation.setSymmetricKey(CryptoHelper.hexToBytes(key));
|
||||
return null;
|
||||
}
|
||||
final OtrService otrService = conversation.getAccount().getOtrService();
|
||||
Message finishedMessage = new Message(conversation, body, Message.ENCRYPTION_OTR, Message.STATUS_RECEIVED);
|
||||
finishedMessage.setFingerprint(otrService.getFingerprint(otrSession.getRemotePublicKey()));
|
||||
conversation.setLastReceivedOtrMessageId(null);
|
||||
|
||||
return finishedMessage;
|
||||
} catch (Exception e) {
|
||||
conversation.resetOtrSession();
|
||||
|
@ -111,7 +114,7 @@ public class MessageParser extends AbstractParser implements
|
|||
XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = service.processReceivingPayloadMessage(xmppAxolotlMessage);
|
||||
if(plaintextMessage != null) {
|
||||
finishedMessage = new Message(conversation, plaintextMessage.getPlaintext(), Message.ENCRYPTION_AXOLOTL, status);
|
||||
finishedMessage.setAxolotlFingerprint(plaintextMessage.getFingerprint());
|
||||
finishedMessage.setFingerprint(plaintextMessage.getFingerprint());
|
||||
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(finishedMessage.getConversation().getAccount())+" Received Message with session fingerprint: "+plaintextMessage.getFingerprint());
|
||||
}
|
||||
|
||||
|
@ -408,8 +411,8 @@ public class MessageParser extends AbstractParser implements
|
|||
message.getStatus() == Message.STATUS_RECEIVED,
|
||||
message.isCarbon());
|
||||
if (replacedMessage != null) {
|
||||
final boolean fingerprintsMatch = replacedMessage.getAxolotlFingerprint() == null
|
||||
|| replacedMessage.getAxolotlFingerprint().equals(message.getAxolotlFingerprint());
|
||||
final boolean fingerprintsMatch = replacedMessage.getFingerprint() == null
|
||||
|| replacedMessage.getFingerprint().equals(message.getFingerprint());
|
||||
final boolean trueCountersMatch = replacedMessage.getTrueCounterpart() != null
|
||||
&& replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
|
||||
if (fingerprintsMatch && (trueCountersMatch || conversation.getMode() == Conversation.MODE_SINGLE)) {
|
||||
|
|
|
@ -931,7 +931,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
}
|
||||
break;
|
||||
case Message.ENCRYPTION_AXOLOTL:
|
||||
message.setAxolotlFingerprint(account.getAxolotlService().getOwnFingerprint());
|
||||
message.setFingerprint(account.getAxolotlService().getOwnFingerprint());
|
||||
if (message.needsUploading()) {
|
||||
if (account.httpUploadAvailable() || message.fixCounterpart()) {
|
||||
this.sendFileMessage(message, delay);
|
||||
|
@ -977,7 +977,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
}
|
||||
break;
|
||||
case Message.ENCRYPTION_AXOLOTL:
|
||||
message.setAxolotlFingerprint(account.getAxolotlService().getOwnFingerprint());
|
||||
message.setFingerprint(account.getAxolotlService().getOwnFingerprint());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -468,13 +468,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||
highlightInConference(user);
|
||||
}
|
||||
} else {
|
||||
activity.switchToContactDetails(message.getContact(), message.getAxolotlFingerprint());
|
||||
activity.switchToContactDetails(message.getContact(), message.getFingerprint());
|
||||
}
|
||||
} else {
|
||||
Account account = message.getConversation().getAccount();
|
||||
Intent intent = new Intent(activity, EditAccountActivity.class);
|
||||
intent.putExtra("jid", account.getJid().toBareJid().toString());
|
||||
intent.putExtra("fingerprint", message.getAxolotlFingerprint());
|
||||
intent.putExtra("fingerprint", message.getFingerprint());
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
if (message.getEncryption() == Message.ENCRYPTION_AXOLOTL) {
|
||||
XmppAxolotlSession.Trust trust = message.getConversation()
|
||||
.getAccount().getAxolotlService().getFingerprintTrust(
|
||||
message.getAxolotlFingerprint());
|
||||
message.getFingerprint());
|
||||
|
||||
if(trust == null || (!trust.trusted() && !trust.trustedInactive())) {
|
||||
viewHolder.indicator.setColorFilter(activity.getWarningTextColor());
|
||||
|
|
|
@ -378,7 +378,7 @@ public class JingleConnection implements Transferable {
|
|||
message.setEncryption(Message.ENCRYPTION_AXOLOTL);
|
||||
this.file.setKey(transportMessage.getKey());
|
||||
this.file.setIv(transportMessage.getIv());
|
||||
message.setAxolotlFingerprint(transportMessage.getFingerprint());
|
||||
message.setFingerprint(transportMessage.getFingerprint());
|
||||
} else {
|
||||
Log.d(Config.LOGTAG,"could not process KeyTransportMessage");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue