Update libsignal-service-java

This commit is contained in:
AsamK 2022-05-14 15:08:19 +02:00
parent 5837a6982b
commit a80e18169a
14 changed files with 84 additions and 46 deletions

View file

@ -298,8 +298,10 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
.println("Expiration started at: {}",
DateUtils.formatTimestamp(sentTranscriptMessage.expirationStartTimestamp()));
}
var message = sentTranscriptMessage.message();
printDataMessage(writer.indentedWriter(), message);
if (sentTranscriptMessage.message().isPresent()) {
var message = sentTranscriptMessage.message().get();
printDataMessage(writer.indentedWriter(), message);
}
}
if (syncMessage.blocked().isPresent()) {
writer.println("Received sync message with block list");

View file

@ -786,7 +786,7 @@ public class DbusManagerImpl implements Manager {
? Optional.empty()
: Optional.of(new RecipientAddress(null, syncReceived.getDestination())),
Set.of(),
new MessageEnvelope.Data(syncReceived.getTimestamp(),
Optional.of(new MessageEnvelope.Data(syncReceived.getTimestamp(),
syncReceived.getGroupId().length > 0
? Optional.of(new MessageEnvelope.Data.GroupContext(GroupId.unknownVersion(
syncReceived.getGroupId()), false, 0))
@ -806,7 +806,7 @@ public class DbusManagerImpl implements Manager {
Optional.empty(),
List.of(),
List.of(),
List.of()))),
List.of())))),
Optional.empty(),
List.of(),
List.of(),

View file

@ -79,27 +79,29 @@ public class DbusReceiveMessageHandler implements Manager.ReceiveMessageHandler
if (syncMessage.sent().isPresent()) {
var transcript = syncMessage.sent().get();
if (transcript.destination().isPresent() || transcript.message().groupContext().isPresent()) {
var message = transcript.message();
var groupId = message.groupContext()
.map(MessageEnvelope.Data.GroupContext::groupId)
.map(GroupId::serialize)
.orElseGet(() -> new byte[0]);
if (transcript.message().isPresent()) {
final var dataMessage = transcript.message().get();
if (transcript.destination().isPresent() || dataMessage.groupContext().isPresent()) {
var groupId = dataMessage.groupContext()
.map(MessageEnvelope.Data.GroupContext::groupId)
.map(GroupId::serialize)
.orElseGet(() -> new byte[0]);
conn.sendMessage(new Signal.SyncMessageReceived(objectPath,
transcript.message().timestamp(),
senderString,
transcript.destination().map(RecipientAddress::getLegacyIdentifier).orElse(""),
groupId,
message.body().orElse(""),
getAttachments(message)));
conn.sendMessage(new Signal.SyncMessageReceivedV2(objectPath,
transcript.message().timestamp(),
senderString,
transcript.destination().map(RecipientAddress::getLegacyIdentifier).orElse(""),
groupId,
message.body().orElse(""),
getMessageExtras(message)));
conn.sendMessage(new Signal.SyncMessageReceived(objectPath,
dataMessage.timestamp(),
senderString,
transcript.destination().map(RecipientAddress::getLegacyIdentifier).orElse(""),
groupId,
dataMessage.body().orElse(""),
getAttachments(dataMessage)));
conn.sendMessage(new Signal.SyncMessageReceivedV2(objectPath,
dataMessage.timestamp(),
senderString,
transcript.destination().map(RecipientAddress::getLegacyIdentifier).orElse(""),
groupId,
dataMessage.body().orElse(""),
getMessageExtras(dataMessage)));
}
}
}
}

View file

@ -19,10 +19,13 @@ record JsonSyncDataMessage(
return new JsonSyncDataMessage(address.getLegacyIdentifier(),
address.number().orElse(null),
address.uuid().map(UUID::toString).orElse(null),
JsonDataMessage.from(transcriptMessage.message()));
transcriptMessage.message().map(JsonDataMessage::from).orElse(null));
} else {
return new JsonSyncDataMessage(null, null, null, JsonDataMessage.from(transcriptMessage.message()));
return new JsonSyncDataMessage(null,
null,
null,
transcriptMessage.message().map(JsonDataMessage::from).orElse(null));
}
}
}