mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-25 07:38:04 +01:00
Remove server-side tracking of "supports SMS." Nobody does!
// FREEBIE
This commit is contained in:
@@ -285,7 +285,6 @@ public class AccountController {
|
||||
|
||||
Account account = new Account();
|
||||
account.setNumber(number);
|
||||
account.setSupportsSms(accountAttributes.getSupportsSms());
|
||||
account.addDevice(device);
|
||||
|
||||
accounts.create(account);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class FederationControllerV1 extends FederationController {
|
||||
|
||||
for (Account account : accountList) {
|
||||
byte[] token = Util.getContactToken(account.getNumber());
|
||||
ClientContact clientContact = new ClientContact(token, null, account.getSupportsSms());
|
||||
ClientContact clientContact = new ClientContact(token, null);
|
||||
|
||||
if (!account.isActive()) {
|
||||
clientContact.setInactive(true);
|
||||
|
||||
@@ -25,9 +25,6 @@ public class AccountAttributes {
|
||||
@NotEmpty
|
||||
private String signalingKey;
|
||||
|
||||
@JsonProperty
|
||||
private boolean supportsSms;
|
||||
|
||||
@JsonProperty
|
||||
private boolean fetchesMessages;
|
||||
|
||||
@@ -36,9 +33,8 @@ public class AccountAttributes {
|
||||
|
||||
public AccountAttributes() {}
|
||||
|
||||
public AccountAttributes(String signalingKey, boolean supportsSms, boolean fetchesMessages, int registrationId) {
|
||||
public AccountAttributes(String signalingKey, boolean fetchesMessages, int registrationId) {
|
||||
this.signalingKey = signalingKey;
|
||||
this.supportsSms = supportsSms;
|
||||
this.fetchesMessages = fetchesMessages;
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
@@ -47,10 +43,6 @@ public class AccountAttributes {
|
||||
return signalingKey;
|
||||
}
|
||||
|
||||
public boolean getSupportsSms() {
|
||||
return supportsSms;
|
||||
}
|
||||
|
||||
public boolean getFetchesMessages() {
|
||||
return fetchesMessages;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,10 @@ public class ClientContact {
|
||||
|
||||
private String relay;
|
||||
private boolean inactive;
|
||||
private boolean supportsSms;
|
||||
|
||||
public ClientContact(byte[] token, String relay, boolean supportsSms) {
|
||||
this.token = token;
|
||||
this.relay = relay;
|
||||
this.supportsSms = supportsSms;
|
||||
public ClientContact(byte[] token, String relay) {
|
||||
this.token = token;
|
||||
this.relay = relay;
|
||||
}
|
||||
|
||||
public ClientContact() {}
|
||||
@@ -56,10 +54,6 @@ public class ClientContact {
|
||||
this.relay = relay;
|
||||
}
|
||||
|
||||
public boolean isSupportsSms() {
|
||||
return supportsSms;
|
||||
}
|
||||
|
||||
public boolean isInactive() {
|
||||
return inactive;
|
||||
}
|
||||
@@ -81,7 +75,6 @@ public class ClientContact {
|
||||
|
||||
return
|
||||
Arrays.equals(this.token, that.token) &&
|
||||
this.supportsSms == that.supportsSms &&
|
||||
this.inactive == that.inactive &&
|
||||
(this.relay == null ? (that.relay == null) : this.relay.equals(that.relay));
|
||||
}
|
||||
|
||||
@@ -32,9 +32,6 @@ public class Account {
|
||||
@JsonProperty
|
||||
private String number;
|
||||
|
||||
@JsonProperty
|
||||
private boolean supportsSms;
|
||||
|
||||
@JsonProperty
|
||||
private Set<Device> devices = new HashSet<>();
|
||||
|
||||
@@ -47,10 +44,9 @@ public class Account {
|
||||
public Account() {}
|
||||
|
||||
@VisibleForTesting
|
||||
public Account(String number, boolean supportsSms, Set<Device> devices) {
|
||||
this.number = number;
|
||||
this.supportsSms = supportsSms;
|
||||
this.devices = devices;
|
||||
public Account(String number, Set<Device> devices) {
|
||||
this.number = number;
|
||||
this.devices = devices;
|
||||
}
|
||||
|
||||
public Optional<Device> getAuthenticatedDevice() {
|
||||
@@ -69,14 +65,6 @@ public class Account {
|
||||
return number;
|
||||
}
|
||||
|
||||
public boolean getSupportsSms() {
|
||||
return supportsSms;
|
||||
}
|
||||
|
||||
public void setSupportsSms(boolean supportsSms) {
|
||||
this.supportsSms = supportsSms;
|
||||
}
|
||||
|
||||
public void addDevice(Device device) {
|
||||
this.devices.remove(device);
|
||||
this.devices.add(device);
|
||||
|
||||
@@ -100,7 +100,7 @@ public class AccountsManager {
|
||||
private void updateDirectory(Account account) {
|
||||
if (account.isActive()) {
|
||||
byte[] token = Util.getContactToken(account.getNumber());
|
||||
ClientContact clientContact = new ClientContact(token, null, account.getSupportsSms());
|
||||
ClientContact clientContact = new ClientContact(token, null);
|
||||
directory.add(clientContact);
|
||||
} else {
|
||||
directory.remove(account.getNumber());
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DirectoryManager {
|
||||
}
|
||||
|
||||
public void add(ClientContact contact) {
|
||||
TokenValue tokenValue = new TokenValue(contact.getRelay(), contact.isSupportsSms());
|
||||
TokenValue tokenValue = new TokenValue(contact.getRelay());
|
||||
|
||||
try (Jedis jedis = redisPool.getResource()) {
|
||||
jedis.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
|
||||
@@ -84,7 +84,7 @@ public class DirectoryManager {
|
||||
public void add(BatchOperationHandle handle, ClientContact contact) {
|
||||
try {
|
||||
Pipeline pipeline = handle.pipeline;
|
||||
TokenValue tokenValue = new TokenValue(contact.getRelay(), contact.isSupportsSms());
|
||||
TokenValue tokenValue = new TokenValue(contact.getRelay());
|
||||
|
||||
pipeline.hset(DIRECTORY_KEY, contact.getToken(), objectMapper.writeValueAsBytes(tokenValue));
|
||||
} catch (JsonProcessingException e) {
|
||||
@@ -106,7 +106,7 @@ public class DirectoryManager {
|
||||
}
|
||||
|
||||
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
|
||||
return Optional.of(new ClientContact(token, tokenValue.relay, tokenValue.supportsSms));
|
||||
return Optional.of(new ClientContact(token, tokenValue.relay));
|
||||
} catch (IOException e) {
|
||||
logger.warn("JSON Error", e);
|
||||
return Optional.absent();
|
||||
@@ -133,7 +133,7 @@ public class DirectoryManager {
|
||||
try {
|
||||
if (pair.second().get() != null) {
|
||||
TokenValue tokenValue = objectMapper.readValue(pair.second().get(), TokenValue.class);
|
||||
ClientContact clientContact = new ClientContact(pair.first(), tokenValue.relay, tokenValue.supportsSms);
|
||||
ClientContact clientContact = new ClientContact(pair.first(), tokenValue.relay);
|
||||
|
||||
results.add(clientContact);
|
||||
}
|
||||
@@ -175,14 +175,10 @@ public class DirectoryManager {
|
||||
@JsonProperty(value = "r")
|
||||
private String relay;
|
||||
|
||||
@JsonProperty(value = "s")
|
||||
private boolean supportsSms;
|
||||
|
||||
public TokenValue() {}
|
||||
|
||||
public TokenValue(String relay, boolean supportsSms) {
|
||||
this.relay = relay;
|
||||
this.supportsSms = supportsSms;
|
||||
public TokenValue(String relay) {
|
||||
this.relay = relay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +201,7 @@ public class DirectoryManager {
|
||||
}
|
||||
|
||||
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
|
||||
return Optional.of(new ClientContact(token, tokenValue.relay, tokenValue.supportsSms));
|
||||
return Optional.of(new ClientContact(token, tokenValue.relay));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DirectoryUpdater {
|
||||
for (Account account : accounts) {
|
||||
if (account.isActive()) {
|
||||
byte[] token = Util.getContactToken(account.getNumber());
|
||||
ClientContact clientContact = new ClientContact(token, null, account.getSupportsSms());
|
||||
ClientContact clientContact = new ClientContact(token, null);
|
||||
|
||||
directory.add(batchOperation, clientContact);
|
||||
contactsAdded++;
|
||||
|
||||
Reference in New Issue
Block a user