mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Extend updateContact command with nick given/family name and note
This commit is contained in:
parent
d57442bd2a
commit
5e16123632
7 changed files with 66 additions and 17 deletions
|
@ -26,8 +26,11 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
|
|||
subparser.help("Update the details of a given contact");
|
||||
subparser.addArgument("recipient").help("Contact number");
|
||||
subparser.addArgument("-n", "--name").help("New contact name");
|
||||
subparser.addArgument("--given-name").help("New contact given name");
|
||||
subparser.addArgument("--family-name").help("New contact family name");
|
||||
subparser.addArgument("--given-name").help("New system given name");
|
||||
subparser.addArgument("--family-name").help("New system family name");
|
||||
subparser.addArgument("--nick-given-name").help("New nick given name");
|
||||
subparser.addArgument("--nick-family-name").help("New nick family name");
|
||||
subparser.addArgument("--note").help("New note");
|
||||
subparser.addArgument("-e", "--expiration").type(int.class).help("Set expiration time of messages (seconds)");
|
||||
}
|
||||
|
||||
|
@ -54,8 +57,15 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
|
|||
familyName = "";
|
||||
}
|
||||
}
|
||||
if (givenName != null || familyName != null) {
|
||||
m.setContactName(recipient, givenName, familyName);
|
||||
var nickGivenName = ns.getString("nick-given-name");
|
||||
var nickFamilyName = ns.getString("nick-family-name");
|
||||
var note = ns.getString("note");
|
||||
if (givenName != null
|
||||
|| familyName != null
|
||||
|| nickGivenName != null
|
||||
|| nickFamilyName != null
|
||||
|| note != null) {
|
||||
m.setContactName(recipient, givenName, familyName, nickGivenName, nickFamilyName, note);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IOErrorException("Update contact error: " + e.getMessage(), e);
|
||||
|
|
|
@ -516,7 +516,10 @@ public class DbusManagerImpl implements Manager {
|
|||
public void setContactName(
|
||||
final RecipientIdentifier.Single recipient,
|
||||
final String givenName,
|
||||
final String familyName
|
||||
final String familyName,
|
||||
final String nickGivenName,
|
||||
final String nickFamilyName,
|
||||
final String note
|
||||
) throws NotPrimaryDeviceException {
|
||||
signal.setContactName(recipient.getIdentifier(), givenName);
|
||||
}
|
||||
|
|
|
@ -531,7 +531,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
|||
@Override
|
||||
public void setContactName(final String number, final String name) {
|
||||
try {
|
||||
m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name, "");
|
||||
m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name, "", null, null, null);
|
||||
} catch (NotPrimaryDeviceException e) {
|
||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue