]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/storage/groups/GroupInfoV2.java
5e3115a1a696d29fc22dcddd9817d9e24b973d9e
1 package org
.asamk
.signal
.storage
.groups
;
3 import org
.signal
.storageservice
.protos
.groups
.local
.DecryptedGroup
;
4 import org
.signal
.zkgroup
.groups
.GroupMasterKey
;
5 import org
.whispersystems
.signalservice
.api
.push
.SignalServiceAddress
;
6 import org
.whispersystems
.signalservice
.api
.util
.UuidUtil
;
8 import java
.util
.Collections
;
10 import java
.util
.stream
.Collectors
;
12 public class GroupInfoV2
extends GroupInfo
{
14 private final GroupMasterKey masterKey
;
16 private boolean blocked
;
17 private DecryptedGroup group
; // stored as a file with hexadecimal groupId as name
19 public GroupInfoV2(final byte[] groupId
, final GroupMasterKey masterKey
) {
21 this.masterKey
= masterKey
;
24 public GroupMasterKey
getMasterKey() {
28 public void setGroup(final DecryptedGroup group
) {
32 public DecryptedGroup
getGroup() {
37 public String
getTitle() {
38 if (this.group
== null) {
41 return this.group
.getTitle();
45 public Set
<SignalServiceAddress
> getMembers() {
46 if (this.group
== null) {
47 return Collections
.emptySet();
49 return group
.getMembersList().stream()
50 .map(m
-> new SignalServiceAddress(UuidUtil
.parseOrThrow(m
.getUuid().toByteArray()), null))
51 .collect(Collectors
.toSet());
55 public boolean isBlocked() {
60 public void setBlocked(final boolean blocked
) {
61 this.blocked
= blocked
;
65 public int getMessageExpirationTime() {
66 return this.group
!= null && this.group
.hasDisappearingMessagesTimer()
67 ?
this.group
.getDisappearingMessagesTimer().getDuration()