Add blocking/unblocking for groups

This commit is contained in:
Daniel Schäufele 2020-01-06 23:55:24 +01:00
parent 5ab3152a40
commit ff478a5b0a
8 changed files with 116 additions and 62 deletions

View file

@ -701,6 +701,19 @@ public class Manager implements Signal {
account.save();
}
@Override
public void setGroupBlocked(final byte[] groupId, final boolean blocked) throws GroupNotFoundException {
GroupInfo group = getGroup(groupId);
if (group == null) {
throw new GroupNotFoundException(groupId);
} else {
System.err.println((blocked ? "Blocking" : "Unblocking") + " group " + Base64.encodeBytes(groupId));
group.blocked = blocked;
account.getGroupStore().updateGroup(group);
account.save();
}
}
@Override
public List<byte[]> getGroupIds() {
List<GroupInfo> groups = getGroups();
@ -1441,7 +1454,7 @@ public class Manager implements Signal {
out.write(new DeviceGroup(record.groupId, Optional.fromNullable(record.name),
new ArrayList<>(record.getMembers()), createGroupAvatarAttachment(record.groupId),
record.active, Optional.fromNullable(info != null ? info.messageExpirationTime : null),
Optional.fromNullable(record.color), false));
Optional.fromNullable(record.color), record.blocked));
}
}