]> nmode's Git Repositories - signal-cli/blobdiff - client/src/main.rs
Fix clippy warnings
[signal-cli] / client / src / main.rs
index 61cbabf2cb66b415f6a2a9ef3e90f43bdcac80d9..68de03d44cab39409857db7d7d8fec44f5ea489c 100644 (file)
@@ -2,7 +2,7 @@ use std::{path::PathBuf, time::Duration};
 
 use clap::Parser;
 use jsonrpsee::core::client::{Error as RpcError, Subscription, SubscriptionClientT};
 
 use clap::Parser;
 use jsonrpsee::core::client::{Error as RpcError, Subscription, SubscriptionClientT};
-use serde_json::Value;
+use serde_json::{Error, Value};
 use tokio::{select, time::sleep};
 
 use cli::Cli;
 use tokio::{select, time::sleep};
 
 use cli::Cli;
@@ -70,7 +70,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,
@@ -275,9 +275,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 {
@@ -429,6 +437,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
+        }
     }
 }
 
     }
 }
 
@@ -475,7 +500,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 {