kopia lustrzana https://github.com/ryukoposting/Signal-Android
Only check remote registrationIds for active records.
rodzic
50b4e137b4
commit
6bde55f73b
|
@ -104,19 +104,22 @@ public class TextSecureSessionStore implements SignalServiceSessionStore {
|
||||||
@Override
|
@Override
|
||||||
public Set<SignalProtocolAddress> getAllAddressesWithActiveSessions(List<String> addressNames) throws InvalidRegistrationIdException {
|
public Set<SignalProtocolAddress> getAllAddressesWithActiveSessions(List<String> addressNames) throws InvalidRegistrationIdException {
|
||||||
synchronized (LOCK) {
|
synchronized (LOCK) {
|
||||||
List<SessionDatabase.SessionRow> rows = DatabaseFactory.getSessionDatabase(context).getAllFor(addressNames);
|
List<SessionDatabase.SessionRow> activeRows = DatabaseFactory.getSessionDatabase(context)
|
||||||
|
.getAllFor(addressNames)
|
||||||
|
.stream()
|
||||||
|
.filter(row -> isActive(row.getRecord()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
boolean hasInvalidRegistrationId = rows.stream()
|
boolean hasInvalidRegistrationId = activeRows.stream()
|
||||||
.map(SessionDatabase.SessionRow::getRecord)
|
.map(SessionDatabase.SessionRow::getRecord)
|
||||||
.anyMatch(record -> !isValidRegistrationId(record.getRemoteRegistrationId()));
|
.anyMatch(record -> !isValidRegistrationId(record.getRemoteRegistrationId()));
|
||||||
if (hasInvalidRegistrationId) {
|
if (hasInvalidRegistrationId) {
|
||||||
throw new InvalidRegistrationIdException();
|
throw new InvalidRegistrationIdException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows.stream()
|
return activeRows.stream()
|
||||||
.filter(row -> isActive(row.getRecord()))
|
.map(row -> new SignalProtocolAddress(row.getAddress(), row.getDeviceId()))
|
||||||
.map(row -> new SignalProtocolAddress(row.getAddress(), row.getDeviceId()))
|
.collect(Collectors.toSet());
|
||||||
.collect(Collectors.toSet());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue