mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
8f756cd90c
commit
53d7e0f08b
3 changed files with 21 additions and 0 deletions
|
@ -49,6 +49,8 @@ public sealed interface RecipientIdentifier {
|
|||
return new Number(address.number().get());
|
||||
} else if (address.aci().isPresent()) {
|
||||
return new Uuid(UUID.fromString(address.aci().get()));
|
||||
} else if (address.pni().isPresent()) {
|
||||
return new Pni(address.pni().get());
|
||||
} else if (address.username().isPresent()) {
|
||||
return new Username(address.username().get());
|
||||
}
|
||||
|
@ -71,6 +73,19 @@ public sealed interface RecipientIdentifier {
|
|||
}
|
||||
}
|
||||
|
||||
record Pni(String pni) implements Single {
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return pni;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipientAddress toPartialRecipientAddress() {
|
||||
return new RecipientAddress(null, pni, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
record Number(String number) implements Single {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -77,6 +77,8 @@ public class RecipientHelper {
|
|||
public RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws UnregisteredRecipientException {
|
||||
if (recipient instanceof RecipientIdentifier.Uuid uuidRecipient) {
|
||||
return account.getRecipientResolver().resolveRecipient(ACI.from(uuidRecipient.uuid()));
|
||||
} else if (recipient instanceof RecipientIdentifier.Pni pniRecipient) {
|
||||
return account.getRecipientResolver().resolveRecipient(PNI.parseOrThrow(pniRecipient.pni()));
|
||||
} else if (recipient instanceof RecipientIdentifier.Number numberRecipient) {
|
||||
final var number = numberRecipient.number();
|
||||
return account.getRecipientStore().resolveRecipientByNumber(number, () -> {
|
||||
|
|
|
@ -98,6 +98,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage
|
|||
import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.PNI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceIdType;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.CdsiResourceExhaustedException;
|
||||
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
|
||||
|
@ -836,6 +837,9 @@ public class ManagerImpl implements Manager {
|
|||
if (recipient instanceof RecipientIdentifier.Uuid u) {
|
||||
account.getMessageSendLogStore()
|
||||
.deleteEntryForRecipientNonGroup(targetSentTimestamp, ACI.from(u.uuid()));
|
||||
} else if (recipient instanceof RecipientIdentifier.Pni pni) {
|
||||
account.getMessageSendLogStore()
|
||||
.deleteEntryForRecipientNonGroup(targetSentTimestamp, PNI.parseOrThrow(pni.pni()));
|
||||
} else if (recipient instanceof RecipientIdentifier.Single r) {
|
||||
try {
|
||||
final var recipientId = context.getRecipientHelper().resolveRecipient(r);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue