aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-03 13:27:35 +0200
committerAndreas Straub <andy@strb.org>2015-07-19 21:32:27 +0200
commitec6870307e0ecee8184ddfef73444290e9d15828 (patch)
tree40efdd07879b03e549fcfb85274fab7e7aad1136 /src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
parent18c1e15d002f415c4449afe06e6dc80aef5aeade (diff)
Properly track message sender
Previously, the sender was assumed to be the conversation counterpart. This broke carboned own-device messages. We now track the sender properly, and also set the status (sent by one of the own devices vs received from the counterpart) accordingly.
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
index 01b06c22..06dd2cda 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
@@ -19,13 +19,14 @@ import javax.crypto.spec.SecretKeySpec;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.xml.Element;
+import eu.siacs.conversations.xmpp.jid.Jid;
public class XmppAxolotlMessage {
private byte[] innerKey;
private byte[] ciphertext;
private byte[] iv;
private final Set<XmppAxolotlMessageHeader> headers;
- private final Contact contact;
+ private final Jid from;
private final int sourceDeviceId;
public static class XmppAxolotlMessageHeader {
@@ -82,8 +83,8 @@ public class XmppAxolotlMessage {
}
- public XmppAxolotlMessage(Contact contact, Element axolotlMessage) {
- this.contact = contact;
+ public XmppAxolotlMessage(Jid from, Element axolotlMessage) {
+ this.from = from;
this.sourceDeviceId = Integer.parseInt(axolotlMessage.getAttribute("id"));
this.headers = new HashSet<>();
for(Element child:axolotlMessage.getChildren()) {
@@ -101,8 +102,8 @@ public class XmppAxolotlMessage {
}
}
- public XmppAxolotlMessage(Contact contact, int sourceDeviceId, String plaintext) {
- this.contact = contact;
+ public XmppAxolotlMessage(Jid from, int sourceDeviceId, String plaintext) {
+ this.from = from;
this.sourceDeviceId = sourceDeviceId;
this.headers = new HashSet<>();
this.encrypt(plaintext);
@@ -124,8 +125,8 @@ public class XmppAxolotlMessage {
}
}
- public Contact getContact() {
- return this.contact;
+ public Jid getFrom() {
+ return this.from;
}
public int getSenderDeviceId() {