]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/storage/groups/GroupInfoV2.java
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()
51 .map(m
-> new SignalServiceAddress(UuidUtil
.parseOrThrow(m
.getUuid().toByteArray()), null))
52 .collect(Collectors
.toSet());
56 public Set
<SignalServiceAddress
> getPendingMembers() {
57 if (this.group
== null) {
58 return Collections
.emptySet();
60 return group
.getPendingMembersList()
62 .map(m
-> new SignalServiceAddress(UuidUtil
.parseOrThrow(m
.getUuid().toByteArray()), null))
63 .collect(Collectors
.toSet());
67 public Set
<SignalServiceAddress
> getRequestingMembers() {
68 if (this.group
== null) {
69 return Collections
.emptySet();
71 return group
.getRequestingMembersList()
73 .map(m
-> new SignalServiceAddress(UuidUtil
.parseOrThrow(m
.getUuid().toByteArray()), null))
74 .collect(Collectors
.toSet());
78 public boolean isBlocked() {
83 public void setBlocked(final boolean blocked
) {
84 this.blocked
= blocked
;
88 public int getMessageExpirationTime() {
89 return this.group
!= null && this.group
.hasDisappearingMessagesTimer()
90 ?
this.group
.getDisappearingMessagesTimer().getDuration()