Update message reporting to use sender ACI instead of E164.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
parent
b02539684a
commit
086e3ed4ec
3 changed files with 10 additions and 8 deletions
|
@ -12,6 +12,7 @@ import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
|||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ServerRejectedException;
|
||||
|
||||
|
@ -71,12 +72,13 @@ public class ReportSpamJob extends BaseJob {
|
|||
List<ReportSpamData> reportSpamData = SignalDatabase.mmsSms().getReportSpamMessageServerData(threadId, timestamp, MAX_MESSAGE_COUNT);
|
||||
SignalServiceAccountManager signalServiceAccountManager = ApplicationDependencies.getSignalServiceAccountManager();
|
||||
for (ReportSpamData data : reportSpamData) {
|
||||
Optional<String> e164 = Recipient.resolved(data.getRecipientId()).getE164();
|
||||
if (e164.isPresent()) {
|
||||
signalServiceAccountManager.reportSpam(e164.get(), data.getServerGuid());
|
||||
Optional<ServiceId> serviceId = Recipient.resolved(data.getRecipientId()).getServiceId();
|
||||
|
||||
if (serviceId.isPresent() && !serviceId.get().isUnknown()) {
|
||||
signalServiceAccountManager.reportSpam(serviceId.get(), data.getServerGuid());
|
||||
count++;
|
||||
} else {
|
||||
Log.w(TAG, "Unable to report spam without an e164 for " + data.getRecipientId());
|
||||
Log.w(TAG, "Unable to report spam without an ACI for " + data.getRecipientId());
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "Reported " + count + " out of " + reportSpamData.size() + " messages in thread " + threadId + " as spam");
|
||||
|
|
|
@ -804,8 +804,8 @@ public class SignalServiceAccountManager {
|
|||
return this.pushServiceSocket.getCurrencyConversions();
|
||||
}
|
||||
|
||||
public void reportSpam(String e164, String serverGuid) throws IOException {
|
||||
this.pushServiceSocket.reportSpam(e164, serverGuid);
|
||||
public void reportSpam(ServiceId serviceId, String serverGuid) throws IOException {
|
||||
this.pushServiceSocket.reportSpam(serviceId, serverGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2477,10 +2477,10 @@ public class PushServiceSocket {
|
|||
}
|
||||
}
|
||||
|
||||
public void reportSpam(String e164, String serverGuid)
|
||||
public void reportSpam(ServiceId serviceId, String serverGuid)
|
||||
throws NonSuccessfulResponseCodeException, MalformedResponseException, PushNetworkException
|
||||
{
|
||||
makeServiceRequest(String.format(REPORT_SPAM, e164, serverGuid), "POST", "");
|
||||
makeServiceRequest(String.format(REPORT_SPAM, serviceId.toString(), serverGuid), "POST", "");
|
||||
}
|
||||
|
||||
private static class VerificationCodeResponseHandler implements ResponseCodeHandler {
|
||||
|
|
Loading…
Add table
Reference in a new issue