Only send our profile key to recipient who are in our contact list

This commit is contained in:
AsamK 2020-03-24 14:29:10 +01:00
parent 20bf605e36
commit 26aa31edc2

View file

@ -548,8 +548,7 @@ public class Manager implements Signal {
throws IOException, EncapsulatedExceptions, AttachmentInvalidException { throws IOException, EncapsulatedExceptions, AttachmentInvalidException {
SignalServiceDataMessage.Reaction reaction = new SignalServiceDataMessage.Reaction(emoji, remove, targetAuthor, targetSentTimestamp); SignalServiceDataMessage.Reaction reaction = new SignalServiceDataMessage.Reaction(emoji, remove, targetAuthor, targetSentTimestamp);
final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder() final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder()
.withReaction(reaction) .withReaction(reaction);
.withProfileKey(account.getProfileKey().serialize());
if (groupId != null) { if (groupId != null) {
SignalServiceGroup group = SignalServiceGroup.newBuilder(SignalServiceGroup.Type.DELIVER) SignalServiceGroup group = SignalServiceGroup.newBuilder(SignalServiceGroup.Type.DELIVER)
.withId(groupId) .withId(groupId)
@ -714,7 +713,6 @@ public class Manager implements Signal {
messageBuilder.withAttachments(attachmentPointers); messageBuilder.withAttachments(attachmentPointers);
} }
messageBuilder.withProfileKey(account.getProfileKey().serialize());
sendMessageLegacy(messageBuilder, getSignalServiceAddresses(recipients)); sendMessageLegacy(messageBuilder, getSignalServiceAddresses(recipients));
} }
@ -723,8 +721,7 @@ public class Manager implements Signal {
throws IOException, EncapsulatedExceptions, AttachmentInvalidException, InvalidNumberException { throws IOException, EncapsulatedExceptions, AttachmentInvalidException, InvalidNumberException {
SignalServiceDataMessage.Reaction reaction = new SignalServiceDataMessage.Reaction(emoji, remove, targetAuthor, targetSentTimestamp); SignalServiceDataMessage.Reaction reaction = new SignalServiceDataMessage.Reaction(emoji, remove, targetAuthor, targetSentTimestamp);
final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder() final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder()
.withReaction(reaction) .withReaction(reaction);
.withProfileKey(account.getProfileKey().serialize());
sendMessageLegacy(messageBuilder, getSignalServiceAddresses(recipients)); sendMessageLegacy(messageBuilder, getSignalServiceAddresses(recipients));
} }
@ -1201,8 +1198,10 @@ public class Manager implements Signal {
ContactInfo contact = account.getContactStore().getContact(address); ContactInfo contact = account.getContactStore().getContact(address);
if (contact != null) { if (contact != null) {
messageBuilder.withExpiration(contact.messageExpirationTime); messageBuilder.withExpiration(contact.messageExpirationTime);
messageBuilder.withProfileKey(account.getProfileKey().serialize());
} else { } else {
messageBuilder.withExpiration(0); messageBuilder.withExpiration(0);
messageBuilder.withProfileKey(null);
} }
message = messageBuilder.build(); message = messageBuilder.build();
try { try {