Disallow SMS/MMS sends to UUID-only recipients.
This commit is contained in:
parent
7394b4ac27
commit
5daa027c10
3 changed files with 17 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue