mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add support for banning/unbanning group members
This commit is contained in:
parent
69f1d0c213
commit
2a20e70aab
17 changed files with 246 additions and 16 deletions
|
@ -53,7 +53,7 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||
final var groupInviteLink = group.groupInviteLinkUrl();
|
||||
|
||||
writer.println(
|
||||
"Id: {} Name: {} Description: {} Active: {} Blocked: {} Members: {} Pending members: {} Requesting members: {} Admins: {} Message expiration: {} Link: {}",
|
||||
"Id: {} Name: {} Description: {} Active: {} Blocked: {} Members: {} Pending members: {} Requesting members: {} Admins: {} Banned: {} Message expiration: {} Link: {}",
|
||||
group.groupId().toBase64(),
|
||||
group.title(),
|
||||
group.description(),
|
||||
|
@ -63,6 +63,7 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||
resolveMembers(group.pendingMembers()),
|
||||
resolveMembers(group.requestingMembers()),
|
||||
resolveMembers(group.adminMembers()),
|
||||
resolveMembers(group.bannedMembers()),
|
||||
group.messageExpirationTimer() == 0 ? "disabled" : group.messageExpirationTimer() + "s",
|
||||
groupInviteLink == null ? '-' : groupInviteLink.getUrl());
|
||||
} else {
|
||||
|
@ -95,6 +96,7 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||
resolveJsonMembers(group.pendingMembers()),
|
||||
resolveJsonMembers(group.requestingMembers()),
|
||||
resolveJsonMembers(group.adminMembers()),
|
||||
resolveJsonMembers(group.bannedMembers()),
|
||||
group.permissionAddMember().name(),
|
||||
group.permissionEditDetails().name(),
|
||||
group.permissionSendMessage().name(),
|
||||
|
@ -122,6 +124,7 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||
Set<JsonGroupMember> pendingMembers,
|
||||
Set<JsonGroupMember> requestingMembers,
|
||||
Set<JsonGroupMember> admins,
|
||||
Set<JsonGroupMember> banned,
|
||||
String permissionAddMember,
|
||||
String permissionEditDetails,
|
||||
String permissionSendMessage,
|
||||
|
|
|
@ -55,6 +55,8 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||
subparser.addArgument("--remove-admin")
|
||||
.nargs("*")
|
||||
.help("Specify one or more members to remove group admin privileges");
|
||||
subparser.addArgument("--ban").nargs("*").help("Specify one or more members to ban from joining the group");
|
||||
subparser.addArgument("--unban").nargs("*").help("Specify one or more members to remove from the ban list");
|
||||
|
||||
subparser.addArgument("--reset-link")
|
||||
.action(Arguments.storeTrue())
|
||||
|
@ -114,6 +116,8 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||
var groupRemoveMembers = CommandUtil.getSingleRecipientIdentifiers(ns.getList("remove-member"), localNumber);
|
||||
var groupAdmins = CommandUtil.getSingleRecipientIdentifiers(ns.getList("admin"), localNumber);
|
||||
var groupRemoveAdmins = CommandUtil.getSingleRecipientIdentifiers(ns.getList("remove-admin"), localNumber);
|
||||
var groupBan = CommandUtil.getSingleRecipientIdentifiers(ns.getList("ban"), localNumber);
|
||||
var groupUnban = CommandUtil.getSingleRecipientIdentifiers(ns.getList("unban"), localNumber);
|
||||
var groupAvatar = ns.getString("avatar");
|
||||
var groupResetLink = Boolean.TRUE.equals(ns.getBoolean("reset-link"));
|
||||
var groupLinkState = getGroupLinkState(ns.getString("link"));
|
||||
|
@ -145,6 +149,8 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||
.withRemoveMembers(groupRemoveMembers)
|
||||
.withAdmins(groupAdmins)
|
||||
.withRemoveAdmins(groupRemoveAdmins)
|
||||
.withBanMembers(groupBan)
|
||||
.withUnbanMembers(groupUnban)
|
||||
.withResetGroupLink(groupResetLink)
|
||||
.withGroupLinkState(groupLinkState)
|
||||
.withAddMemberPermission(groupAddMemberPermission)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue