]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusReceiveMessageHandler.java
Update libsignal-service-java
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusReceiveMessageHandler.java
index 34e7105cbd7b603407640695dc95be7f3cdc7b1a..dcea2bf1e674733d16fa7f77e2dd87d0d2260622 100644 (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]);
-
-                    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)));
+                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,
+                                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)));
+                    }
                 }
             }
         }
@@ -162,7 +164,10 @@ public class DbusReceiveMessageHandler implements Manager.ReceiveMessageHandler
     }
 
     private Map<String, Variant<? extends Serializable>> getStickerMap(final MessageEnvelope.Data.Sticker sticker) {
-        return Map.of("packId", new Variant<>(sticker.packId()), "stickerId", new Variant<>(sticker.stickerId()));
+        return Map.of("packId",
+                new Variant<>(sticker.packId().serialize()),
+                "stickerId",
+                new Variant<>(sticker.stickerId()));
     }
 
     private Map<String, Variant<?>> getReactionMap(final MessageEnvelope.Data.Reaction reaction) {