Disallow SMS/MMS sends to UUID-only recipients.

fork-5.53.8
Greyson Parrelli 2021-04-08 16:18:42 -04:00
rodzic 7394b4ac27
commit 5daa027c10
3 zmienionych plików z 17 dodań i 2 usunięć

Wyświetl plik

@ -1517,7 +1517,10 @@ public class ConversationActivity extends PassphraseRequiredActivity
sendButton.resetAvailableTransports(isMediaMessage);
if (!isSecureText && !isPushGroupConversation()) sendButton.disableTransport(Type.TEXTSECURE);
if (recipient.get().isPushGroup()) sendButton.disableTransport(Type.SMS);
if (recipient.get().isPushGroup() || (!recipient.get().isMmsGroup() && !recipient.get().hasSmsAddress())) {
sendButton.disableTransport(Type.SMS);
}
if (!recipient.get().isPushGroup() && recipient.get().isForceSmsSelection()) {
sendButton.setDefaultTransport(Type.SMS);

Wyświetl plik

@ -242,6 +242,10 @@ public final class MmsSendJob extends SendJob {
List<Recipient> members = DatabaseFactory.getGroupDatabase(context).getGroupMembers(message.getRecipient().requireGroupId(), GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
for (Recipient member : members) {
if (!member.hasSmsAddress()) {
throw new UndeliverableMessageException("One of the group recipients did not have an SMS address! " + member.getId());
}
if (message.getDistributionType() == ThreadDatabase.DistributionTypes.BROADCAST) {
req.addBcc(new EncodedStringValue(member.requireSmsAddress()));
} else {
@ -249,6 +253,10 @@ public final class MmsSendJob extends SendJob {
}
}
} else {
if (!message.getRecipient().hasSmsAddress()) {
throw new UndeliverableMessageException("Recipient did not have an SMS address! " + message.getRecipient().getId());
}
req.addTo(new EncodedStringValue(message.getRecipient().requireSmsAddress()));
}

Wyświetl plik

@ -72,7 +72,7 @@ public class SmsSendJob extends SendJob {
}
@Override
public void onSend() throws NoSuchMessageException, TooManyRetriesException {
public void onSend() throws NoSuchMessageException, TooManyRetriesException, UndeliverableMessageException {
if (runAttempt >= MAX_ATTEMPTS) {
warn(TAG, "Hit the retry limit. Failing.");
throw new TooManyRetriesException();
@ -86,6 +86,10 @@ public class SmsSendJob extends SendJob {
return;
}
if (!record.getRecipient().hasSmsAddress()) {
throw new UndeliverableMessageException("Recipient didn't have an SMS address! " + record.getRecipient().getId());
}
try {
log(TAG, String.valueOf(record.getDateSent()), "Sending message: " + messageId + " (attempt " + runAttempt + ")");
deliver(record);