Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dxr_client requirement from 0.6.2 to 0.7.0 #31

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:?}"))
}
}
Loading