mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Include unrestricted unidentified access state in getUserStatus response
This commit is contained in:
parent
376fcba9ec
commit
bb9d44811c
6 changed files with 36 additions and 24 deletions
|
@ -22,6 +22,7 @@ import org.asamk.signal.manager.api.StickerPackInvalidException;
|
|||
import org.asamk.signal.manager.api.StickerPackUrl;
|
||||
import org.asamk.signal.manager.api.TypingAction;
|
||||
import org.asamk.signal.manager.api.UpdateGroup;
|
||||
import org.asamk.signal.manager.api.UserStatus;
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||
|
@ -53,7 +54,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -87,14 +87,16 @@ public class DbusManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Pair<String, UUID>> areUsersRegistered(final Set<String> numbers) throws IOException {
|
||||
public Map<String, UserStatus> getUserStatus(final Set<String> numbers) throws IOException {
|
||||
final var numbersList = new ArrayList<>(numbers);
|
||||
final var registered = signal.isRegistered(numbersList);
|
||||
|
||||
final var result = new HashMap<String, Pair<String, UUID>>();
|
||||
final var result = new HashMap<String, UserStatus>();
|
||||
for (var i = 0; i < numbersList.size(); i++) {
|
||||
result.put(numbersList.get(i),
|
||||
new Pair<>(numbersList.get(i), registered.get(i) ? RecipientAddress.UNKNOWN_UUID : null));
|
||||
new UserStatus(numbersList.get(i),
|
||||
registered.get(i) ? RecipientAddress.UNKNOWN_UUID : null,
|
||||
false));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.asamk.signal.manager.api.StickerPackInvalidException;
|
|||
import org.asamk.signal.manager.api.TypingAction;
|
||||
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
||||
import org.asamk.signal.manager.api.UpdateGroup;
|
||||
import org.asamk.signal.manager.api.UserStatus;
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupLinkState;
|
||||
|
@ -53,7 +54,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -641,17 +641,14 @@ public class DbusSignalImpl implements Signal {
|
|||
return List.of();
|
||||
}
|
||||
|
||||
Map<String, Pair<String, UUID>> registered;
|
||||
Map<String, UserStatus> registered;
|
||||
try {
|
||||
registered = m.areUsersRegistered(new HashSet<>(numbers));
|
||||
registered = m.getUserStatus(new HashSet<>(numbers));
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure(e.getMessage());
|
||||
}
|
||||
|
||||
return numbers.stream().map(number -> {
|
||||
var uuid = registered.get(number).second();
|
||||
return uuid != null;
|
||||
}).toList();
|
||||
return numbers.stream().map(number -> registered.get(number).uuid() != null).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue