]> nmode's Git Repositories - signal-cli/blobdiff - client/src/main.rs
Add missing username parameter to getUserStatus command in json-rpc client
[signal-cli] / client / src / main.rs
index 03aff481c94bfa52e4aea7c3996e8a0983865c9f..6466b2e628d4d7a216e1f19c9cdcd8b8f4ad13b6 100644 (file)
@@ -1,9 +1,8 @@
 use std::{path::PathBuf, time::Duration};
 
 use clap::Parser;
 use std::{path::PathBuf, time::Duration};
 
 use clap::Parser;
-use jsonrpsee::core::client::{Subscription, SubscriptionClientT};
-use jsonrpsee::core::Error as RpcError;
-use serde_json::Value;
+use jsonrpsee::core::client::{Error as RpcError, Subscription, SubscriptionClientT};
+use serde_json::{Error, Value};
 use tokio::{select, time::sleep};
 
 use cli::Cli;
 use tokio::{select, time::sleep};
 
 use cli::Cli;
@@ -61,8 +60,13 @@ async fn handle_command(
                 .delete_local_account_data(cli.account, ignore_registered)
                 .await
         }
                 .delete_local_account_data(cli.account, ignore_registered)
                 .await
         }
-        CliCommands::GetUserStatus { recipient } => {
-            client.get_user_status(cli.account, recipient).await
+        CliCommands::GetUserStatus {
+            recipient,
+            username,
+        } => {
+            client
+                .get_user_status(cli.account, recipient, username)
+                .await
         }
         CliCommands::JoinGroup { uri } => client.join_group(cli.account, uri).await,
         CliCommands::Link { name } => {
         }
         CliCommands::JoinGroup { uri } => client.join_group(cli.account, uri).await,
         CliCommands::Link { name } => {
@@ -71,7 +75,7 @@ async fn handle_command(
                 .await
                 .map_err(|e| RpcError::Custom(format!("JSON-RPC command startLink failed: {e:?}")))?
                 .device_link_uri;
                 .await
                 .map_err(|e| RpcError::Custom(format!("JSON-RPC command startLink failed: {e:?}")))?
                 .device_link_uri;
-            println!("{}", url);
+            println!("{url}");
             client.finish_link(url, name).await
         }
         CliCommands::ListAccounts => client.list_accounts().await,
             client.finish_link(url, name).await
         }
         CliCommands::ListAccounts => client.list_accounts().await,
@@ -276,9 +280,17 @@ async fn handle_command(
         CliCommands::UpdateAccount {
             device_name,
             unrestricted_unidentified_sender,
         CliCommands::UpdateAccount {
             device_name,
             unrestricted_unidentified_sender,
+            discoverable_by_number,
+            number_sharing,
         } => {
             client
         } => {
             client
-                .update_account(cli.account, device_name, unrestricted_unidentified_sender)
+                .update_account(
+                    cli.account,
+                    device_name,
+                    unrestricted_unidentified_sender,
+                    discoverable_by_number,
+                    number_sharing,
+                )
                 .await
         }
         CliCommands::UpdateConfiguration {
                 .await
         }
         CliCommands::UpdateConfiguration {
@@ -408,6 +420,19 @@ async fn handle_command(
                 .get_attachment(cli.account, id, recipient, group_id)
                 .await
         }
                 .get_attachment(cli.account, id, recipient, group_id)
                 .await
         }
+        CliCommands::GetAvatar {
+            contact,
+            profile,
+            group_id,
+        } => {
+            client
+                .get_avatar(cli.account, contact, profile, group_id)
+                .await
+        }
+        CliCommands::GetSticker {
+            pack_id,
+            sticker_id,
+        } => client.get_sticker(cli.account, pack_id, sticker_id).await,
         CliCommands::StartChangeNumber {
             number,
             voice,
         CliCommands::StartChangeNumber {
             number,
             voice,
@@ -417,6 +442,23 @@ async fn handle_command(
                 .start_change_number(cli.account, number, voice, captcha)
                 .await
         }
                 .start_change_number(cli.account, number, voice, captcha)
                 .await
         }
+        CliCommands::SendMessageRequestResponse {
+            recipient,
+            group_id,
+            r#type,
+        } => {
+            client
+                .send_message_request_response(
+                    cli.account,
+                    recipient,
+                    group_id,
+                    match r#type {
+                        cli::MessageRequestResponseType::Accept => "accept".to_owned(),
+                        cli::MessageRequestResponseType::Delete => "delete".to_owned(),
+                    },
+                )
+                .await
+        }
     }
 }
 
     }
 }
 
@@ -463,7 +505,7 @@ async fn connect(cli: Cli) -> Result<Value, RpcError> {
 async fn stream_next(
     timeout: f64,
     stream: &mut Subscription<Value>,
 async fn stream_next(
     timeout: f64,
     stream: &mut Subscription<Value>,
-) -> Option<Result<Value, RpcError>> {
+) -> Option<Result<Value, Error>> {
     if timeout < 0.0 {
         stream.next().await
     } else {
     if timeout < 0.0 {
         stream.next().await
     } else {