]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/JsonGroupStore.java
Store untrusted identities in identityKeyStore
[signal-cli] / src / main / java / org / asamk / signal / JsonGroupStore.java
index 29dc00317ba1d40f59394b10c4875eb5df807444..da512706928773d7690ae53972c5fc476e985da7 100644 (file)
@@ -19,17 +19,16 @@ public class JsonGroupStore {
     @JsonDeserialize(using = JsonGroupStore.GroupsDeserializer.class)
     private Map<String, GroupInfo> groups = new HashMap<>();
 
+    public static List<GroupInfo> groupsWithLegacyAvatarId = new ArrayList<>();
+
     private static final ObjectMapper jsonProcessot = new ObjectMapper();
 
     void updateGroup(GroupInfo group) {
         groups.put(Base64.encodeBytes(group.groupId), group);
     }
 
-    GroupInfo getGroup(byte[] groupId) throws GroupNotFoundException {
+    GroupInfo getGroup(byte[] groupId) {
         GroupInfo g = groups.get(Base64.encodeBytes(groupId));
-        if (g == null) {
-            throw new GroupNotFoundException(groupId);
-        }
         return g;
     }
 
@@ -51,6 +50,10 @@ public class JsonGroupStore {
             JsonNode node = jsonParser.getCodec().readTree(jsonParser);
             for (JsonNode n : node) {
                 GroupInfo g = jsonProcessot.treeToValue(n, GroupInfo.class);
+                // Check if a legacy avatarId exists
+                if (g.getAvatarId() != 0) {
+                    groupsWithLegacyAvatarId.add(g);
+                }
                 groups.put(Base64.encodeBytes(g.groupId), g);
             }