mirror of
https://github.com/aljazceru/signal-cli.git
synced 2025-12-18 22:54:20 +01:00
Update dependencies
updateProfile can now only update both name and avatar at the same time, as the upstream API has changed.
This commit is contained in:
@@ -14,16 +14,18 @@ public class UpdateProfileCommand implements LocalCommand {
|
||||
|
||||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
final MutuallyExclusiveGroup avatarOptions = subparser.addMutuallyExclusiveGroup();
|
||||
final MutuallyExclusiveGroup avatarOptions = subparser.addMutuallyExclusiveGroup()
|
||||
.required(true);
|
||||
avatarOptions.addArgument("--avatar")
|
||||
.help("Path to new profile avatar");
|
||||
avatarOptions.addArgument("--remove-avatar")
|
||||
.action(Arguments.storeTrue());
|
||||
|
||||
subparser.addArgument("--name")
|
||||
.required(true)
|
||||
.help("New profile name");
|
||||
|
||||
subparser.help("Set a name and/or avatar image for the user profile");
|
||||
subparser.help("Set a name and avatar image for the user profile");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,38 +36,15 @@ public class UpdateProfileCommand implements LocalCommand {
|
||||
}
|
||||
|
||||
String name = ns.getString("name");
|
||||
|
||||
if (name != null) {
|
||||
try {
|
||||
m.setProfileName(name);
|
||||
} catch (IOException e) {
|
||||
System.err.println("UpdateAccount error: " + e.getMessage());
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
String avatarPath = ns.getString("avatar");
|
||||
|
||||
if (avatarPath != null) {
|
||||
File avatarFile = new File(avatarPath);
|
||||
|
||||
try {
|
||||
m.setProfileAvatar(avatarFile);
|
||||
} catch (IOException e) {
|
||||
System.err.println("UpdateAccount error: " + e.getMessage());
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
boolean removeAvatar = ns.getBoolean("remove_avatar");
|
||||
|
||||
if (removeAvatar) {
|
||||
try {
|
||||
m.removeProfileAvatar();
|
||||
} catch (IOException e) {
|
||||
System.err.println("UpdateAccount error: " + e.getMessage());
|
||||
return 3;
|
||||
}
|
||||
try {
|
||||
File avatarFile = removeAvatar ? null : new File(avatarPath);
|
||||
m.setProfile(name, avatarFile);
|
||||
} catch (IOException e) {
|
||||
System.err.println("UpdateAccount error: " + e.getMessage());
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user