From c70515035f37572c6067260c387210885db30a3b Mon Sep 17 00:00:00 2001 From: AsamK Date: Sat, 28 Feb 2026 13:25:28 +0100 Subject: [PATCH] Add missing flags to jsonrpc client --- client/src/cli.rs | 49 ++++++++++++++++++++++++++++++++++ client/src/jsonrpc.rs | 50 ++++++++++++++++++++++------------ client/src/main.rs | 62 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 139 insertions(+), 22 deletions(-) diff --git a/client/src/cli.rs b/client/src/cli.rs index 0161b0e9..28643a25 100644 --- a/client/src/cli.rs +++ b/client/src/cli.rs @@ -10,6 +10,9 @@ pub struct Cli { #[arg(short = 'a', long)] pub account: Option, + #[arg(long)] + pub output: Option, + /// TCP host and port of signal-cli daemon #[arg(long, conflicts_with = "json_rpc_http")] pub json_rpc_tcp: Option>, @@ -105,6 +108,10 @@ pub enum CliCommands { blocked: Option, #[arg(long)] name: Option, + #[arg(long)] + detailed: bool, + #[arg(long)] + internal: bool, }, ListDevices, ListGroups { @@ -135,6 +142,8 @@ pub enum CliCommands { voice: bool, #[arg(long)] captcha: Option, + #[arg(long)] + reregister: bool, }, RemoveContact { recipient: String, @@ -167,15 +176,24 @@ pub enum CliCommands { #[arg(short = 'g', long)] group_id: Vec, + #[arg(short = 'u', long = "username")] + username: Vec, + #[arg(long)] note_to_self: bool, + #[arg(long)] + notify_self: bool, + #[arg(short = 'e', long)] end_session: bool, #[arg(short = 'm', long)] message: Option, + #[arg(long)] + message_from_stdin: bool, + #[arg(short = 'a', long)] attachment: Vec, @@ -229,6 +247,9 @@ pub enum CliCommands { #[arg(long)] edit_timestamp: Option, + + #[arg(long = "no-urgent")] + no_urgent: bool, }, SendAdminDelete { #[arg(short = 'g', long = "group-id")] @@ -358,9 +379,15 @@ pub enum CliCommands { #[arg(short = 'g', long = "group-id")] group_id: Vec, + #[arg(short = 'u', long = "username")] + username: Vec, + #[arg(long = "note-to-self")] note_to_self: bool, + #[arg(long)] + notify_self: bool, + #[arg(short = 'e', long)] emoji: String, @@ -379,6 +406,9 @@ pub enum CliCommands { SendReceipt { recipient: String, + #[arg(short = 'u', long = "username")] + username: Vec, + #[arg(short = 't', long = "target-timestamp")] target_timestamp: Vec, @@ -471,6 +501,10 @@ pub enum CliCommands { discoverable_by_number: Option, #[arg(long = "number-sharing")] number_sharing: Option, + #[arg(short = 'u', long = "username")] + username: Option, + #[arg(long = "delete-username")] + delete_username: bool, }, UpdateConfiguration { #[arg(long = "read-receipts")] @@ -493,6 +527,21 @@ pub enum CliCommands { #[arg(short = 'n', long)] name: Option, + + #[arg(long = "given-name")] + given_name: Option, + + #[arg(long = "family-name")] + family_name: Option, + + #[arg(long = "nick-given-name")] + nick_given_name: Option, + + #[arg(long = "nick-family-name")] + nick_family_name: Option, + + #[arg(long)] + note: Option, }, UpdateDevice { #[arg(short = 'd', long = "device-id")] diff --git a/client/src/jsonrpc.rs b/client/src/jsonrpc.rs index 1e5cfcb8..0cba9c8d 100644 --- a/client/src/jsonrpc.rs +++ b/client/src/jsonrpc.rs @@ -104,6 +104,8 @@ pub trait Rpc { #[allow(non_snake_case)] allRecipients: bool, blocked: Option, name: Option, + detailed: bool, + internal: bool, ) -> Result; #[method(name = "listDevices", param_kind = map)] @@ -141,6 +143,7 @@ pub trait Rpc { account: Option, voice: bool, captcha: Option, + reregister: bool, ) -> Result; #[method(name = "removeContact", param_kind = map)] @@ -179,27 +182,30 @@ pub trait Rpc { account: Option, recipients: Vec, groupIds: Vec, - noteToSelf: bool, - endSession: bool, + usernames: Vec, + #[allow(non_snake_case)] notifySelf: bool, + #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] endSession: bool, message: String, attachments: Vec, - viewOnce: bool, + #[allow(non_snake_case)] viewOnce: bool, mentions: Vec, - textStyle: Vec, - quoteTimestamp: Option, - quoteAuthor: Option, - quoteMessage: Option, - quoteMention: Vec, - quoteTextStyle: Vec, - quoteAttachment: Vec, - previewUrl: Option, - previewTitle: Option, - previewDescription: Option, - previewImage: Option, + #[allow(non_snake_case)] textStyle: Vec, + #[allow(non_snake_case)] quoteTimestamp: Option, + #[allow(non_snake_case)] quoteAuthor: Option, + #[allow(non_snake_case)] quoteMessage: Option, + #[allow(non_snake_case)] quoteMention: Vec, + #[allow(non_snake_case)] quoteTextStyle: Vec, + #[allow(non_snake_case)] quoteAttachment: Vec, + #[allow(non_snake_case)] previewUrl: Option, + #[allow(non_snake_case)] previewTitle: Option, + #[allow(non_snake_case)] previewDescription: Option, + #[allow(non_snake_case)] previewImage: Option, sticker: Option, - storyTimestamp: Option, - storyAuthor: Option, - editTimestamp: Option, + #[allow(non_snake_case)] storyTimestamp: Option, + #[allow(non_snake_case)] storyAuthor: Option, + #[allow(non_snake_case)] editTimestamp: Option, + #[allow(non_snake_case)] noUrgent: bool, ) -> Result; #[method(name = "sendContacts", param_kind = map)] @@ -301,7 +307,9 @@ pub trait Rpc { account: Option, recipients: Vec, #[allow(non_snake_case)] groupIds: Vec, + usernames: Vec, #[allow(non_snake_case)] noteToSelf: bool, + #[allow(non_snake_case)] notifySelf: bool, emoji: String, #[allow(non_snake_case)] targetAuthor: String, #[allow(non_snake_case)] targetTimestamp: u64, @@ -314,6 +322,7 @@ pub trait Rpc { &self, account: Option, recipient: String, + usernames: Vec, #[allow(non_snake_case)] targetTimestamps: Vec, r#type: String, ) -> Result; @@ -395,6 +404,8 @@ pub trait Rpc { unrestrictedUnidentifiedSender: Option, discoverableByNumber: Option, numberSharing: Option, + username: Option, + deleteUsername: bool, ) -> Result; #[method(name = "updateConfiguration", param_kind = map)] @@ -414,6 +425,11 @@ pub trait Rpc { recipient: String, name: Option, expiration: Option, + #[allow(non_snake_case)] givenName: Option, + #[allow(non_snake_case)] familyName: Option, + #[allow(non_snake_case)] nickGivenName: Option, + #[allow(non_snake_case)] nickFamilyName: Option, + note: Option, ) -> Result; #[method(name = "updateDevice", param_kind = map)] diff --git a/client/src/main.rs b/client/src/main.rs index e5c4fa50..f389630e 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -84,9 +84,19 @@ async fn handle_command( all_recipients, blocked, name, + detailed, + internal, } => { client - .list_contacts(cli.account, recipient, all_recipients, blocked, name) + .list_contacts( + cli.account, + recipient, + all_recipients, + blocked, + name, + detailed, + internal, + ) .await } CliCommands::ListDevices => client.list_devices(cli.account).await, @@ -105,8 +115,14 @@ async fn handle_command( .quit_group(cli.account, group_id, delete, admin) .await } - CliCommands::Register { voice, captcha } => { - client.register(cli.account, voice, captcha).await + CliCommands::Register { + voice, + captcha, + reregister, + } => { + client + .register(cli.account, voice, captcha, reregister) + .await } CliCommands::RemoveContact { recipient, @@ -140,9 +156,12 @@ async fn handle_command( CliCommands::Send { recipient, group_id, + username, + notify_self, note_to_self, end_session, message, + message_from_stdin, attachment, view_once, mention, @@ -161,15 +180,22 @@ async fn handle_command( story_timestamp, story_author, edit_timestamp, + no_urgent, } => { client .send( cli.account, recipient, group_id, + username, + notify_self, note_to_self, end_session, - message.unwrap_or_default(), + if message_from_stdin { + std::io::read_to_string(std::io::stdin()).unwrap() + } else { + message.unwrap_or_default() + }, attachment, view_once, mention, @@ -188,6 +214,7 @@ async fn handle_command( story_timestamp, story_author, edit_timestamp, + no_urgent, ) .await } @@ -318,7 +345,9 @@ async fn handle_command( CliCommands::SendReaction { recipient, group_id, + username, note_to_self, + notify_self, emoji, target_author, target_timestamp, @@ -330,7 +359,9 @@ async fn handle_command( cli.account, recipient, group_id, + username, note_to_self, + notify_self, emoji, target_author, target_timestamp, @@ -341,6 +372,7 @@ async fn handle_command( } CliCommands::SendReceipt { recipient, + username, target_timestamp, r#type, } => { @@ -348,6 +380,7 @@ async fn handle_command( .send_receipt( cli.account, recipient, + username, target_timestamp, match r#type { cli::ReceiptType::Read => "read".to_owned(), @@ -422,6 +455,8 @@ async fn handle_command( unrestricted_unidentified_sender, discoverable_by_number, number_sharing, + username, + delete_username, } => { client .update_account( @@ -430,6 +465,8 @@ async fn handle_command( unrestricted_unidentified_sender, discoverable_by_number, number_sharing, + username, + delete_username, ) .await } @@ -453,9 +490,24 @@ async fn handle_command( recipient, expiration, name, + given_name, + family_name, + nick_given_name, + nick_family_name, + note, } => { client - .update_contact(cli.account, recipient, name, expiration) + .update_contact( + cli.account, + recipient, + name, + expiration, + given_name, + family_name, + nick_given_name, + nick_family_name, + note, + ) .await } CliCommands::UpdateDevice {