X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/ae41d0c5026fe868c6198e1005344fc78b6e0a2c..9a775171b573089592e82f7c3bf8f5b0fdd7d975:/src/main/java/org/asamk/signal/json/JsonGroupInfo.java diff --git a/src/main/java/org/asamk/signal/json/JsonGroupInfo.java b/src/main/java/org/asamk/signal/json/JsonGroupInfo.java index 572623e4..bc3e7e0e 100644 --- a/src/main/java/org/asamk/signal/json/JsonGroupInfo.java +++ b/src/main/java/org/asamk/signal/json/JsonGroupInfo.java @@ -1,10 +1,12 @@ package org.asamk.signal.json; +import org.asamk.signal.manager.groups.GroupUtils; import org.whispersystems.signalservice.api.messages.SignalServiceGroup; +import org.whispersystems.signalservice.api.messages.SignalServiceGroupV2; import org.whispersystems.signalservice.api.push.SignalServiceAddress; -import org.whispersystems.util.Base64; import java.util.ArrayList; +import java.util.Base64; import java.util.List; class JsonGroupInfo { @@ -15,11 +17,11 @@ class JsonGroupInfo { String type; JsonGroupInfo(SignalServiceGroup groupInfo) { - this.groupId = Base64.encodeBytes(groupInfo.getGroupId()); + this.groupId = Base64.getEncoder().encodeToString(groupInfo.getGroupId()); if (groupInfo.getMembers().isPresent()) { this.members = new ArrayList<>(groupInfo.getMembers().get().size()); for (SignalServiceAddress address : groupInfo.getMembers().get()) { - this.members.add(address.getNumber().get()); + this.members.add(address.getLegacyIdentifier()); } } if (groupInfo.getName().isPresent()) { @@ -28,7 +30,12 @@ class JsonGroupInfo { this.type = groupInfo.getType().toString(); } + JsonGroupInfo(SignalServiceGroupV2 groupInfo) { + this.groupId = GroupUtils.getGroupIdV2(groupInfo.getMasterKey()).toBase64(); + this.type = groupInfo.hasSignedGroupChange() ? "UPDATE" : "DELIVER"; + } + JsonGroupInfo(byte[] groupId) { - this.groupId = Base64.encodeBytes(groupId); + this.groupId = Base64.getEncoder().encodeToString(groupId); } }