mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20: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());
|
return new Number(address.number().get());
|
||||||
} else if (address.aci().isPresent()) {
|
} else if (address.aci().isPresent()) {
|
||||||
return new Uuid(UUID.fromString(address.aci().get()));
|
return new Uuid(UUID.fromString(address.aci().get()));
|
||||||
|
} else if (address.pni().isPresent()) {
|
||||||
|
return new Pni(address.pni().get());
|
||||||
} else if (address.username().isPresent()) {
|
} else if (address.username().isPresent()) {
|
||||||
return new Username(address.username().get());
|
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 {
|
record Number(String number) implements Single {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -77,6 +77,8 @@ public class RecipientHelper {
|
||||||
public RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws UnregisteredRecipientException {
|
public RecipientId resolveRecipient(final RecipientIdentifier.Single recipient) throws UnregisteredRecipientException {
|
||||||
if (recipient instanceof RecipientIdentifier.Uuid uuidRecipient) {
|
if (recipient instanceof RecipientIdentifier.Uuid uuidRecipient) {
|
||||||
return account.getRecipientResolver().resolveRecipient(ACI.from(uuidRecipient.uuid()));
|
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) {
|
} else if (recipient instanceof RecipientIdentifier.Number numberRecipient) {
|
||||||
final var number = numberRecipient.number();
|
final var number = numberRecipient.number();
|
||||||
return account.getRecipientStore().resolveRecipientByNumber(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.messages.SignalServiceTypingMessage;
|
||||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
|
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.ServiceIdType;
|
||||||
import org.whispersystems.signalservice.api.push.exceptions.CdsiResourceExhaustedException;
|
import org.whispersystems.signalservice.api.push.exceptions.CdsiResourceExhaustedException;
|
||||||
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
|
import org.whispersystems.signalservice.api.util.DeviceNameUtil;
|
||||||
|
@ -836,6 +837,9 @@ public class ManagerImpl implements Manager {
|
||||||
if (recipient instanceof RecipientIdentifier.Uuid u) {
|
if (recipient instanceof RecipientIdentifier.Uuid u) {
|
||||||
account.getMessageSendLogStore()
|
account.getMessageSendLogStore()
|
||||||
.deleteEntryForRecipientNonGroup(targetSentTimestamp, ACI.from(u.uuid()));
|
.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) {
|
} else if (recipient instanceof RecipientIdentifier.Single r) {
|
||||||
try {
|
try {
|
||||||
final var recipientId = context.getRecipientHelper().resolveRecipient(r);
|
final var recipientId = context.getRecipientHelper().resolveRecipient(r);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue