}
/**
- * @param name if null, the previous name will be kept
+ * @param givenName if null, the previous givenName will be kept
+ * @param familyName if null, the previous familyName will be kept
* @param about if null, the previous about text will be kept
* @param aboutEmoji if null, the previous about emoji will be kept
* @param avatar if avatar is null the image from the local avatar store is used (if present),
- * if it's Optional.absent(), the avatar will be removed
*/
- public void setProfile(String name, String about, String aboutEmoji, Optional<File> avatar) throws IOException {
+ public void setProfile(
+ String givenName, final String familyName, String about, String aboutEmoji, Optional<File> avatar
+ ) throws IOException {
var profile = getRecipientProfile(account.getSelfRecipientId());
var builder = profile == null ? Profile.newBuilder() : Profile.newBuilder(profile);
- if (name != null) {
- builder.withGivenName(name);
- builder.withFamilyName(null);
+ if (givenName != null) {
+ builder.withGivenName(givenName);
+ }
+ if (familyName != null) {
+ builder.withFamilyName(familyName);
}
if (about != null) {
builder.withAbout(about);
m.refreshPreKeys();
// Set an initial empty profile so user can be added to groups
- m.setProfile(null, null, null, null);
+ m.setProfile(null, null, null, null, null);
final var result = m;
m = null;
=== updateProfile
-Update the name and avatar image visible by message recipients for the current users.
+Update the profile information shown to message recipients.
The profile is stored encrypted on the Signal servers.
-The decryption key is sent with every outgoing messages to contacts.
+The decryption key is sent with every outgoing messages to contacts and included
+in every group.
-*--name*::
-New name visible by message recipients.
+*--given-name* NAME, *--name* NAME::
+New (given) name.
-*--avatar*::
-Path to the new avatar visible by message recipients.
+*--family-name* FAMILY_NAME::
+New family name.
+
+*--about* ABOUT_TEXT::
+New profile status text.
+
+*--about-emoji* EMOJI::
+New profile status emoji.
+
+*--avatar* AVATAR_FILE::
+Path to the new avatar image file.
*--remove-avatar*::
-Remove the avatar visible by message recipients.
+Remove the avatar
=== updateContact
@Override
public void attachToSubparser(final Subparser subparser) {
- subparser.addArgument("--name").help("New profile name");
+ subparser.addArgument("--given-name", "--name").help("New profile (given) name");
+ subparser.addArgument("--family-name").help("New profile family name (optional)");
subparser.addArgument("--about").help("New profile about text");
subparser.addArgument("--about-emoji").help("New profile about emoji");
@Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
- var name = ns.getString("name");
+ var givenName = ns.getString("given_name");
+ var familyName = ns.getString("family_name");
var about = ns.getString("about");
var aboutEmoji = ns.getString("about_emoji");
var avatarPath = ns.getString("avatar");
: avatarPath == null ? null : Optional.of(new File(avatarPath));
try {
- m.setProfile(name, about, aboutEmoji, avatarFile);
+ m.setProfile(givenName, familyName, about, aboutEmoji, avatarFile);
} catch (IOException e) {
throw new IOErrorException("Update profile error: " + e.getMessage());
}
Optional<File> avatarFile = removeAvatar
? Optional.absent()
: avatarPath == null ? null : Optional.of(new File(avatarPath));
- m.setProfile(name, about, aboutEmoji, avatarFile);
+ m.setProfile(name, null, about, aboutEmoji, avatarFile);
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
}