Always include profile key in direct messages

Adjusts behavior to official client

Fixes #416
This commit is contained in:
AsamK 2021-01-14 18:41:21 +01:00
parent 9bba7a85ab
commit 9bb935b11f

View file

@ -1342,16 +1342,12 @@ public class Manager implements Closeable {
} }
} else { } else {
// Send to all individually, so sync messages are sent correctly // Send to all individually, so sync messages are sent correctly
messageBuilder.withProfileKey(account.getProfileKey().serialize());
List<SendMessageResult> results = new ArrayList<>(recipients.size()); List<SendMessageResult> results = new ArrayList<>(recipients.size());
for (SignalServiceAddress address : recipients) { for (SignalServiceAddress address : recipients) {
ContactInfo contact = account.getContactStore().getContact(address); final ContactInfo contact = account.getContactStore().getContact(address);
if (contact != null) { final int expirationTime = contact != null ? contact.messageExpirationTime : 0;
messageBuilder.withExpiration(contact.messageExpirationTime); messageBuilder.withExpiration(expirationTime);
messageBuilder.withProfileKey(account.getProfileKey().serialize());
} else {
messageBuilder.withExpiration(0);
messageBuilder.withProfileKey(null);
}
message = messageBuilder.build(); message = messageBuilder.build();
if (address.matches(account.getSelfAddress())) { if (address.matches(account.getSelfAddress())) {
results.add(sendSelfMessage(message)); results.add(sendSelfMessage(message));