kopia lustrzana https://github.com/ryukoposting/Signal-Android
Update message reporting to use sender ACI instead of E164.
Co-authored-by: Greyson Parrelli <greyson@signal.org>fork-5.53.8
rodzic
b02539684a
commit
086e3ed4ec
|
@ -12,6 +12,7 @@ import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
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.NonSuccessfulResponseCodeException;
|
||||||
import org.whispersystems.signalservice.api.push.exceptions.ServerRejectedException;
|
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);
|
List<ReportSpamData> reportSpamData = SignalDatabase.mmsSms().getReportSpamMessageServerData(threadId, timestamp, MAX_MESSAGE_COUNT);
|
||||||
SignalServiceAccountManager signalServiceAccountManager = ApplicationDependencies.getSignalServiceAccountManager();
|
SignalServiceAccountManager signalServiceAccountManager = ApplicationDependencies.getSignalServiceAccountManager();
|
||||||
for (ReportSpamData data : reportSpamData) {
|
for (ReportSpamData data : reportSpamData) {
|
||||||
Optional<String> e164 = Recipient.resolved(data.getRecipientId()).getE164();
|
Optional<ServiceId> serviceId = Recipient.resolved(data.getRecipientId()).getServiceId();
|
||||||
if (e164.isPresent()) {
|
|
||||||
signalServiceAccountManager.reportSpam(e164.get(), data.getServerGuid());
|
if (serviceId.isPresent() && !serviceId.get().isUnknown()) {
|
||||||
|
signalServiceAccountManager.reportSpam(serviceId.get(), data.getServerGuid());
|
||||||
count++;
|
count++;
|
||||||
} else {
|
} 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");
|
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();
|
return this.pushServiceSocket.getCurrencyConversions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reportSpam(String e164, String serverGuid) throws IOException {
|
public void reportSpam(ServiceId serviceId, String serverGuid) throws IOException {
|
||||||
this.pushServiceSocket.reportSpam(e164, serverGuid);
|
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
|
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 {
|
private static class VerificationCodeResponseHandler implements ResponseCodeHandler {
|
||||||
|
|
Ładowanie…
Reference in New Issue