mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Implement refuse group join requests
This commit is contained in:
parent
489fb2ac22
commit
c9c8af42c2
2 changed files with 24 additions and 0 deletions
|
@ -618,6 +618,12 @@ public class GroupHelper {
|
||||||
var groupGroupChangePair = groupV2Helper.revokeInvitedMembers(group, pendingRemoveMembers);
|
var groupGroupChangePair = groupV2Helper.revokeInvitedMembers(group, pendingRemoveMembers);
|
||||||
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
}
|
}
|
||||||
|
var requestingRemoveMembers = new HashSet<>(removeMembers);
|
||||||
|
requestingRemoveMembers.retainAll(group.getRequestingMembers());
|
||||||
|
if (requestingRemoveMembers.size() > 0) {
|
||||||
|
var groupGroupChangePair = groupV2Helper.refuseJoinRequestMembers(group, requestingRemoveMembers);
|
||||||
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (admins != null) {
|
if (admins != null) {
|
||||||
|
|
|
@ -287,6 +287,17 @@ class GroupV2Helper {
|
||||||
return ejectMembers(groupInfoV2, memberUuids);
|
return ejectMembers(groupInfoV2, memberUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pair<DecryptedGroup, GroupChange> refuseJoinRequestMembers(
|
||||||
|
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
||||||
|
) throws IOException {
|
||||||
|
final var memberUuids = members.stream()
|
||||||
|
.map(context.getRecipientHelper()::resolveSignalServiceAddress)
|
||||||
|
.map(SignalServiceAddress::getServiceId)
|
||||||
|
.map(ServiceId::uuid)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
return refuseJoinRequest(groupInfoV2, memberUuids);
|
||||||
|
}
|
||||||
|
|
||||||
Pair<DecryptedGroup, GroupChange> revokeInvitedMembers(
|
Pair<DecryptedGroup, GroupChange> revokeInvitedMembers(
|
||||||
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
|
@ -513,6 +524,13 @@ class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, groupOperations.createRemoveInvitationChange(uuidCipherTexts));
|
return commitChange(groupInfoV2, groupOperations.createRemoveInvitationChange(uuidCipherTexts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Pair<DecryptedGroup, GroupChange> refuseJoinRequest(
|
||||||
|
GroupInfoV2 groupInfoV2, Set<UUID> uuids
|
||||||
|
) throws IOException {
|
||||||
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
return commitChange(groupInfoV2, groupOperations.createRefuseGroupJoinRequest(uuids, false, List.of()));
|
||||||
|
}
|
||||||
|
|
||||||
private Pair<DecryptedGroup, GroupChange> ejectMembers(
|
private Pair<DecryptedGroup, GroupChange> ejectMembers(
|
||||||
GroupInfoV2 groupInfoV2, Set<UUID> uuids
|
GroupInfoV2 groupInfoV2, Set<UUID> uuids
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue