diff --git a/src/xmlrpc.rs b/src/xmlrpc.rs index 9ee4728..8425ef4 100644 --- a/src/xmlrpc.rs +++ b/src/xmlrpc.rs @@ -1,4 +1,4 @@ -use dxr_client::{Call, Client, ClientBuilder}; +use dxr_client::{Client, ClientBuilder, ClientError}; use url::Url; pub struct Xmlrpc { @@ -11,23 +11,23 @@ impl Xmlrpc { } } - fn request<'a>( + async fn request<'a>( + &self, service: &'static str, command: &'static str, params: Vec<&'a str>, - ) -> Call<'a, Vec<&'a str>, String> { - Call::new( - "atheme.command", - [vec!["", "", "127.0.0.1", service, command], params].concat(), - ) + ) -> Result<(), ClientError> { + self.client + .call( + "atheme.command", + [vec!["", "", "127.0.0.1", service, command], params].concat(), + ) + .await } pub async fn verify(&self, account: &str, token: &str) -> Result<(), String> { - let request = Xmlrpc::request("NickServ", "VERIFY", vec!["REGISTER", account, token]); - self.client - .call(request) + self.request("NickServ", "VERIFY", vec!["REGISTER", account, token]) .await - .map(|_| ()) .map_err(|e| format!("{e:?}")) } }