1 package org
.asamk
.signal
.storage
.groups
;
3 import com
.fasterxml
.jackson
.annotation
.JsonIgnore
;
4 import com
.fasterxml
.jackson
.annotation
.JsonProperty
;
6 import org
.whispersystems
.signalservice
.api
.push
.SignalServiceAddress
;
8 import java
.util
.Collection
;
9 import java
.util
.HashSet
;
12 public class GroupInfo
{
15 public final byte[] groupId
;
21 public Set
<String
> members
= new HashSet
<>();
24 @JsonProperty(defaultValue
= "false")
25 public boolean blocked
;
27 public Integer inboxPosition
;
28 @JsonProperty(defaultValue
= "false")
29 public boolean archived
;
31 private long avatarId
;
35 private boolean active
;
37 public GroupInfo(byte[] groupId
) {
38 this.groupId
= groupId
;
41 public GroupInfo(@JsonProperty("groupId") byte[] groupId
, @JsonProperty("name") String name
, @JsonProperty("members") Collection
<String
> members
, @JsonProperty("avatarId") long avatarId
, @JsonProperty("color") String color
, @JsonProperty("blocked") boolean blocked
, @JsonProperty("inboxPosition") Integer inboxPosition
, @JsonProperty("archived") boolean archived
) {
42 this.groupId
= groupId
;
44 this.members
.addAll(members
);
45 this.avatarId
= avatarId
;
47 this.blocked
= blocked
;
48 this.inboxPosition
= inboxPosition
;
49 this.archived
= archived
;
53 public long getAvatarId() {
58 public Set
<SignalServiceAddress
> getMembers() {
59 Set
<SignalServiceAddress
> addresses
= new HashSet
<>(members
.size());
60 for (String member
: members
) {
61 addresses
.add(new SignalServiceAddress(null, member
));
66 public void addMembers(Collection
<SignalServiceAddress
> members
) {
67 for (SignalServiceAddress member
: members
) {
68 this.members
.add(member
.getNumber().get());