Skip to content

Commit

Permalink
Merge pull request #31 from Libera-Chat/dependabot/cargo/dxr_client-0…
Browse files Browse the repository at this point in the history
….7.0

Update dxr_client requirement from 0.6.2 to 0.7.0
  • Loading branch information
glguy authored Dec 9, 2024
2 parents e8d0e11 + 5c919fd commit f022ed5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "nickserv account verification URL bot"

[dependencies]
clap = { version = "4.5.9", features = ["derive"] }
dxr_client = { version = "0.6.2", features = ["reqwest"] }
dxr_client = { version = "0.7.0", features = ["reqwest"] }
http = "0.2.12" # warp is stuck on an old version
http-serde = "1.1.3"
hyper = "1.4.1"
Expand Down
22 changes: 11 additions & 11 deletions src/xmlrpc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use dxr_client::{Call, Client, ClientBuilder};
use dxr_client::{Client, ClientBuilder, ClientError};
use url::Url;

pub struct Xmlrpc {
Expand All @@ -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:?}"))
}
}

0 comments on commit f022ed5

Please sign in to comment.