]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/dbus/DbusManagerImpl.java
Recreate recipient database with aci column
[signal-cli] / src / main / java / org / asamk / signal / dbus / DbusManagerImpl.java
index e6a18307f39c4d67d30a6d00a8d270f3dbec4794..3d0e2263d02a886be6e7479dae03c8c6a812b6ec 100644 (file)
@@ -670,7 +670,18 @@ public class DbusManagerImpl implements Manager {
             }
             return Recipient.newBuilder()
                     .withAddress(new RecipientAddress(null, n))
             }
             return Recipient.newBuilder()
                     .withAddress(new RecipientAddress(null, n))
-                    .withContact(new Contact(contactName, null, null, 0, contactBlocked, false, false, false))
+                    .withContact(new Contact(contactName,
+                            null,
+                            null,
+                            null,
+                            0,
+                            0,
+                            false,
+                            contactBlocked,
+                            false,
+                            false,
+                            false,
+                            null))
                     .build();
         }).filter(Objects::nonNull).toList();
     }
                     .build();
         }).filter(Objects::nonNull).toList();
     }
@@ -849,7 +860,7 @@ public class DbusManagerImpl implements Manager {
                                 Optional.empty(),
                                 Optional.empty(),
                                 List.of(),
                                 Optional.empty(),
                                 Optional.empty(),
                                 List.of(),
-                                List.of(),
+                                getMentions(extras),
                                 List.of(),
                                 List.of())),
                         Optional.empty(),
                                 List.of(),
                                 List.of())),
                         Optional.empty(),
@@ -893,7 +904,7 @@ public class DbusManagerImpl implements Manager {
                                         Optional.empty(),
                                         Optional.empty(),
                                         List.of(),
                                         Optional.empty(),
                                         Optional.empty(),
                                         List.of(),
-                                        List.of(),
+                                        getMentions(extras),
                                         List.of(),
                                         List.of()))),
                         Optional.empty(),
                                         List.of(),
                                         List.of()))),
                         Optional.empty(),
@@ -970,7 +981,7 @@ public class DbusManagerImpl implements Manager {
                                         Optional.empty(),
                                         Optional.empty(),
                                         List.of(),
                                         Optional.empty(),
                                         Optional.empty(),
                                         List.of(),
-                                        List.of(),
+                                        getMentions(extras),
                                         List.of(),
                                         List.of())),
                                 Optional.empty(),
                                         List.of(),
                                         List.of())),
                                 Optional.empty(),
@@ -1039,6 +1050,19 @@ public class DbusManagerImpl implements Manager {
         }).toList();
     }
 
         }).toList();
     }
 
+    private List<MessageEnvelope.Data.Mention> getMentions(final Map<String, Variant<?>> extras) {
+        if (!extras.containsKey("mentions")) {
+            return List.of();
+        }
+
+        final List<DBusMap<String, Variant<?>>> mentions = getValue(extras, "mentions");
+        return mentions.stream()
+                .map(a -> new MessageEnvelope.Data.Mention(new RecipientAddress(null, getValue(a, "recipient")),
+                        getValue(a, "start"),
+                        getValue(a, "length")))
+                .toList();
+    }
+
     @Override
     public InputStream retrieveAttachment(final String id) throws IOException {
         throw new UnsupportedOperationException();
     @Override
     public InputStream retrieveAttachment(final String id) throws IOException {
         throw new UnsupportedOperationException();