mirror of
https://github.com/aljazceru/signal-cli.git
synced 2026-01-27 01:24:20 +01:00
Split given/family name in updateContact command
This commit is contained in:
@@ -149,7 +149,7 @@ public interface Manager extends Closeable {
|
||||
void deleteContact(RecipientIdentifier.Single recipient);
|
||||
|
||||
void setContactName(
|
||||
RecipientIdentifier.Single recipient, String name
|
||||
RecipientIdentifier.Single recipient, String givenName, final String familyName
|
||||
) throws NotPrimaryDeviceException, IOException, UnregisteredRecipientException;
|
||||
|
||||
void setContactsBlocked(
|
||||
|
||||
@@ -705,12 +705,13 @@ class ManagerImpl implements Manager {
|
||||
|
||||
@Override
|
||||
public void setContactName(
|
||||
RecipientIdentifier.Single recipient, String name
|
||||
RecipientIdentifier.Single recipient, String givenName, final String familyName
|
||||
) throws NotPrimaryDeviceException, UnregisteredRecipientException {
|
||||
if (!account.isPrimaryDevice()) {
|
||||
throw new NotPrimaryDeviceException();
|
||||
}
|
||||
context.getContactHelper().setContactName(context.getRecipientHelper().resolveRecipient(recipient), name);
|
||||
context.getContactHelper()
|
||||
.setContactName(context.getRecipientHelper().resolveRecipient(recipient), givenName, familyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,10 +17,16 @@ public class ContactHelper {
|
||||
return sourceContact != null && sourceContact.isBlocked();
|
||||
}
|
||||
|
||||
public void setContactName(final RecipientId recipientId, final String name) {
|
||||
public void setContactName(final RecipientId recipientId, final String givenName, final String familyName) {
|
||||
var contact = account.getContactStore().getContact(recipientId);
|
||||
final var builder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
|
||||
account.getContactStore().storeContact(recipientId, builder.withGivenName(name).build());
|
||||
if (givenName != null) {
|
||||
builder.withGivenName(givenName);
|
||||
}
|
||||
if (familyName != null) {
|
||||
builder.withFamilyName(familyName);
|
||||
}
|
||||
account.getContactStore().storeContact(recipientId, builder.build());
|
||||
}
|
||||
|
||||
public void setExpirationTimer(RecipientId recipientId, int messageExpirationTimer) {
|
||||
|
||||
Reference in New Issue
Block a user