aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-03-31 21:15:49 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-03-31 21:15:49 +0200
commite074104004fa146611ce39cd32751ab3cd718dd1 (patch)
treec2519b1a0fa3390572cd5d64c4d9d1c8dbfafeb4 /src/main/java/eu
parent867d0ef191faf5af2573e7721d2fb14390eca0ee (diff)
save otr fingerprint in message
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Message.java4
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java11
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java2
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java2
6 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java
index be9d3d92..f6a45533 100644
--- a/src/main/java/eu/siacs/conversations/entities/Message.java
+++ b/src/main/java/eu/siacs/conversations/entities/Message.java
@@ -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;
}
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 9470dab8..21bdbdf6 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -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)) {
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index bf498bc6..cc0a8f70 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -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;
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 679e2a03..1a834ae5 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -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);
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index ab9f74a3..0268097f 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -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());
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index e3eec647..beed92fa 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -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");
}