Only allow active groups to start ringing.

main
Cody Henthorne 2022-11-08 15:54:00 -05:00
rodzic f96c31b38f
commit 18c32a7a80
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -743,13 +743,13 @@ private void processStateless(@NonNull Function1<WebRtcEphemeralState, WebRtcEph
@Override @Override
public void onGroupCallRingUpdate(@NonNull byte[] groupIdBytes, long ringId, @NonNull UUID uuid, @NonNull CallManager.RingUpdate ringUpdate) { public void onGroupCallRingUpdate(@NonNull byte[] groupIdBytes, long ringId, @NonNull UUID uuid, @NonNull CallManager.RingUpdate ringUpdate) {
try { try {
GroupId.V2 groupId = GroupId.v2(new GroupIdentifier(groupIdBytes)); GroupId.V2 groupId = GroupId.v2(new GroupIdentifier(groupIdBytes));
Optional<GroupDatabase.GroupRecord> group = SignalDatabase.groups().getGroup(groupId); GroupDatabase.GroupRecord group = SignalDatabase.groups().getGroup(groupId).orElse(null);
if (group.isPresent()) { if (group != null && group.isActive() && !Recipient.resolved(group.getRecipientId()).isBlocked()) {
process((s, p) -> p.handleGroupCallRingUpdate(s, new RemotePeer(group.get().getRecipientId()), groupId, ringId, uuid, ringUpdate)); process((s, p) -> p.handleGroupCallRingUpdate(s, new RemotePeer(group.getRecipientId()), groupId, ringId, uuid, ringUpdate));
} else { } else {
Log.w(TAG, "Unable to ring unknown group."); Log.w(TAG, "Unable to ring unknown/inactive/blocked group.");
} }
} catch (InvalidInputException e) { } catch (InvalidInputException e) {
Log.w(TAG, "Unable to ring group due to invalid group id", e); Log.w(TAG, "Unable to ring group due to invalid group id", e);