mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
17 lines
536 B
Java
17 lines
536 B
Java
package org.asamk.signal.json;
|
|
|
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
|
|
|
import java.util.Base64;
|
|
|
|
record JsonGroupInfo(String groupId, String type) {
|
|
|
|
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext) {
|
|
return new JsonGroupInfo(groupContext.groupId().toBase64(),
|
|
groupContext.isGroupUpdate() ? "UPDATE" : "DELIVER");
|
|
}
|
|
|
|
static JsonGroupInfo from(byte[] groupId) {
|
|
return new JsonGroupInfo(Base64.getEncoder().encodeToString(groupId), "DELIVER");
|
|
}
|
|
}
|