mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-06-19 18:31:18 +00:00
Handle unregistered username correctly when sending message
Fixes #1824
This commit is contained in:
parent
e60b80effc
commit
371dc06842
@ -1137,7 +1137,7 @@
|
||||
"allDeclaredFields":true,
|
||||
"queryAllDeclaredMethods":true,
|
||||
"queryAllDeclaredConstructors":true,
|
||||
"methods":[{"name":"number","parameterTypes":[] }, {"name":"uuid","parameterTypes":[] }]
|
||||
"methods":[{"name":"number","parameterTypes":[] }, {"name":"username","parameterTypes":[] }, {"name":"uuid","parameterTypes":[] }]
|
||||
},
|
||||
{
|
||||
"name":"org.asamk.signal.json.JsonRemoteDelete",
|
||||
|
||||
@ -95,7 +95,10 @@ public class RecipientHelper {
|
||||
try {
|
||||
return resolveRecipientByUsernameOrLink(username, false);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
throw new UnregisteredRecipientException(new org.asamk.signal.manager.api.RecipientAddress(null,
|
||||
null,
|
||||
null,
|
||||
username));
|
||||
}
|
||||
}
|
||||
throw new AssertionError("Unexpected RecipientIdentifier: " + recipient);
|
||||
|
||||
@ -4,9 +4,11 @@ import org.asamk.signal.manager.api.RecipientAddress;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record JsonRecipientAddress(String uuid, String number) {
|
||||
public record JsonRecipientAddress(String uuid, String number, String username) {
|
||||
|
||||
public static JsonRecipientAddress from(RecipientAddress address) {
|
||||
return new JsonRecipientAddress(address.uuid().map(UUID::toString).orElse(null), address.number().orElse(null));
|
||||
return new JsonRecipientAddress(address.uuid().map(UUID::toString).orElse(null),
|
||||
address.number().orElse(null),
|
||||
address.username().orElse(null));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user