Shaheen Gandhi 09eb707b4d Add JSON-RPC commands for voice call control
Add startCall, acceptCall, hangupCall, rejectCall, and listCalls
commands for the JSON-RPC daemon interface. Register commands and
update GraalVM metadata for native image support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 13:48:09 -08:00

92 lines
3.6 KiB
Java

package org.asamk.signal.commands;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
public class Commands {
private static final Map<String, Command> commands = new HashMap<>();
private static final Map<String, SubparserAttacher> commandSubparserAttacher = new TreeMap<>();
static {
addCommand(new AcceptCallCommand());
addCommand(new AddDeviceCommand());
addCommand(new BlockCommand());
addCommand(new DaemonCommand());
addCommand(new DeleteLocalAccountDataCommand());
addCommand(new FinishChangeNumberCommand());
addCommand(new FinishLinkCommand());
addCommand(new HangupCallCommand());
addCommand(new GetAttachmentCommand());
addCommand(new GetAvatarCommand());
addCommand(new GetStickerCommand());
addCommand(new GetUserStatusCommand());
addCommand(new AddStickerPackCommand());
addCommand(new JoinGroupCommand());
addCommand(new ListCallsCommand());
addCommand(new JsonRpcDispatcherCommand());
addCommand(new LinkCommand());
addCommand(new ListAccountsCommand());
addCommand(new ListContactsCommand());
addCommand(new ListDevicesCommand());
addCommand(new ListGroupsCommand());
addCommand(new ListIdentitiesCommand());
addCommand(new ListStickerPacksCommand());
addCommand(new QuitGroupCommand());
addCommand(new ReceiveCommand());
addCommand(new RejectCallCommand());
addCommand(new RegisterCommand());
addCommand(new RemoveContactCommand());
addCommand(new RemoveDeviceCommand());
addCommand(new RemovePinCommand());
addCommand(new RemoteDeleteCommand());
addCommand(new SendCommand());
addCommand(new SendContactsCommand());
addCommand(new SendMessageRequestResponseCommand());
addCommand(new SendPaymentNotificationCommand());
addCommand(new SendPollCreateCommand());
addCommand(new SendPollVoteCommand());
addCommand(new SendPollTerminateCommand());
addCommand(new SendReactionCommand());
addCommand(new SendReceiptCommand());
addCommand(new SendSyncRequestCommand());
addCommand(new SendTypingCommand());
addCommand(new SetPinCommand());
addCommand(new StartCallCommand());
addCommand(new SubmitRateLimitChallengeCommand());
addCommand(new StartChangeNumberCommand());
addCommand(new StartLinkCommand());
addCommand(new TrustCommand());
addCommand(new UnblockCommand());
addCommand(new UnregisterCommand());
addCommand(new UpdateAccountCommand());
addCommand(new UpdateConfigurationCommand());
addCommand(new UpdateContactCommand());
addCommand(new UpdateDeviceCommand());
addCommand(new UpdateGroupCommand());
addCommand(new UpdateProfileCommand());
addCommand(new UploadStickerPackCommand());
addCommand(new VerifyCommand());
addCommand(new VersionCommand());
}
public static Map<String, SubparserAttacher> getCommandSubparserAttachers() {
return commandSubparserAttacher;
}
public static Command getCommand(String commandKey) {
if (!commands.containsKey(commandKey)) {
return null;
}
return commands.get(commandKey);
}
private static void addCommand(Command command) {
commands.put(command.getName(), command);
if (command instanceof CliCommand cliCommand) {
commandSubparserAttacher.put(command.getName(), cliCommand::attachToSubparser);
}
}
}