Initial checkin
This commit contains autogenerated telepathy DBUS code and the output of `cargo new telepathy-delta`. It's pretty chill.
This commit is contained in:
153
src/telepathy/channel_interface_captcha_authentication.rs
Normal file
153
src/telepathy/channel_interface_captcha_authentication.rs
Normal file
@@ -0,0 +1,153 @@
|
||||
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Interface_Captcha_Authentication.xml -i org.freedesktop.Telepathy -o src/telepathy/channel_interface_captcha_authentication.rs`, see https://github.com/diwic/dbus-rs
|
||||
use dbus;
|
||||
use dbus::arg;
|
||||
use dbus::tree;
|
||||
|
||||
pub trait ChannelInterfaceCaptchaAuthentication1 {
|
||||
fn get_captchas(
|
||||
&self,
|
||||
) -> Result<(Vec<(u32, String, String, u32, Vec<String>)>, u32, String), tree::MethodErr>;
|
||||
fn get_captcha_data(&self, id: u32, mime_type: &str) -> Result<Vec<u8>, tree::MethodErr>;
|
||||
fn answer_captchas(
|
||||
&self,
|
||||
answers: ::std::collections::HashMap<u32, &str>,
|
||||
) -> Result<(), tree::MethodErr>;
|
||||
fn cancel_captcha(&self, reason: u32, debug_message: &str) -> Result<(), tree::MethodErr>;
|
||||
fn can_retry_captcha(&self) -> Result<bool, tree::MethodErr>;
|
||||
fn captcha_status(&self) -> Result<u32, tree::MethodErr>;
|
||||
fn captcha_error(&self) -> Result<String, tree::MethodErr>;
|
||||
fn captcha_error_details(
|
||||
&self,
|
||||
) -> Result<
|
||||
::std::collections::HashMap<String, arg::Variant<Box<dyn arg::RefArg + 'static>>>,
|
||||
tree::MethodErr,
|
||||
>;
|
||||
}
|
||||
|
||||
pub fn channel_interface_captcha_authentication1_server<F, T, D>(
|
||||
factory: &tree::Factory<tree::MTFn<D>, D>,
|
||||
data: D::Interface,
|
||||
f: F,
|
||||
) -> tree::Interface<tree::MTFn<D>, D>
|
||||
where
|
||||
D: tree::DataType,
|
||||
D::Method: Default,
|
||||
D::Property: Default,
|
||||
T: ChannelInterfaceCaptchaAuthentication1,
|
||||
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
|
||||
{
|
||||
let i = factory.interface(
|
||||
"org.freedesktop.Telepathy.Channel.Interface.CaptchaAuthentication1",
|
||||
data,
|
||||
);
|
||||
let f = ::std::sync::Arc::new(f);
|
||||
let fclone = f.clone();
|
||||
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
||||
let d = fclone(minfo);
|
||||
let (captcha_info, number_required, language) = d.get_captchas()?;
|
||||
let rm = minfo.msg.method_return();
|
||||
let rm = rm.append1(captcha_info);
|
||||
let rm = rm.append1(number_required);
|
||||
let rm = rm.append1(language);
|
||||
Ok(vec![rm])
|
||||
};
|
||||
let m = factory.method("GetCaptchas", Default::default(), h);
|
||||
let m = m.out_arg(("Captcha_Info", "a(ussuas)"));
|
||||
let m = m.out_arg(("Number_Required", "u"));
|
||||
let m = m.out_arg(("Language", "s"));
|
||||
let i = i.add_m(m);
|
||||
|
||||
let fclone = f.clone();
|
||||
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
||||
let mut i = minfo.msg.iter_init();
|
||||
let id: u32 = i.read()?;
|
||||
let mime_type: &str = i.read()?;
|
||||
let d = fclone(minfo);
|
||||
let captcha_data = d.get_captcha_data(id, mime_type)?;
|
||||
let rm = minfo.msg.method_return();
|
||||
let rm = rm.append1(captcha_data);
|
||||
Ok(vec![rm])
|
||||
};
|
||||
let m = factory.method("GetCaptchaData", Default::default(), h);
|
||||
let m = m.in_arg(("ID", "u"));
|
||||
let m = m.in_arg(("Mime_Type", "s"));
|
||||
let m = m.out_arg(("Captcha_Data", "ay"));
|
||||
let i = i.add_m(m);
|
||||
|
||||
let fclone = f.clone();
|
||||
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
||||
let mut i = minfo.msg.iter_init();
|
||||
let answers: ::std::collections::HashMap<u32, &str> = i.read()?;
|
||||
let d = fclone(minfo);
|
||||
d.answer_captchas(answers)?;
|
||||
let rm = minfo.msg.method_return();
|
||||
Ok(vec![rm])
|
||||
};
|
||||
let m = factory.method("AnswerCaptchas", Default::default(), h);
|
||||
let m = m.in_arg(("Answers", "a{us}"));
|
||||
let i = i.add_m(m);
|
||||
|
||||
let fclone = f.clone();
|
||||
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
||||
let mut i = minfo.msg.iter_init();
|
||||
let reason: u32 = i.read()?;
|
||||
let debug_message: &str = i.read()?;
|
||||
let d = fclone(minfo);
|
||||
d.cancel_captcha(reason, debug_message)?;
|
||||
let rm = minfo.msg.method_return();
|
||||
Ok(vec![rm])
|
||||
};
|
||||
let m = factory.method("CancelCaptcha", Default::default(), h);
|
||||
let m = m.in_arg(("Reason", "u"));
|
||||
let m = m.in_arg(("Debug_Message", "s"));
|
||||
let i = i.add_m(m);
|
||||
|
||||
let p = factory.property::<bool, _>("CanRetryCaptcha", Default::default());
|
||||
let p = p.access(tree::Access::Read);
|
||||
let fclone = f.clone();
|
||||
let p = p.on_get(move |a, pinfo| {
|
||||
let minfo = pinfo.to_method_info();
|
||||
let d = fclone(&minfo);
|
||||
a.append(d.can_retry_captcha()?);
|
||||
Ok(())
|
||||
});
|
||||
let i = i.add_p(p);
|
||||
|
||||
let p = factory.property::<u32, _>("CaptchaStatus", Default::default());
|
||||
let p = p.access(tree::Access::Read);
|
||||
let fclone = f.clone();
|
||||
let p = p.on_get(move |a, pinfo| {
|
||||
let minfo = pinfo.to_method_info();
|
||||
let d = fclone(&minfo);
|
||||
a.append(d.captcha_status()?);
|
||||
Ok(())
|
||||
});
|
||||
let i = i.add_p(p);
|
||||
|
||||
let p = factory.property::<&str, _>("CaptchaError", Default::default());
|
||||
let p = p.access(tree::Access::Read);
|
||||
let fclone = f.clone();
|
||||
let p = p.on_get(move |a, pinfo| {
|
||||
let minfo = pinfo.to_method_info();
|
||||
let d = fclone(&minfo);
|
||||
a.append(d.captcha_error()?);
|
||||
Ok(())
|
||||
});
|
||||
let i = i.add_p(p);
|
||||
|
||||
let p = factory
|
||||
.property::<::std::collections::HashMap<&str, arg::Variant<Box<dyn arg::RefArg>>>, _>(
|
||||
"CaptchaErrorDetails",
|
||||
Default::default(),
|
||||
);
|
||||
let p = p.access(tree::Access::Read);
|
||||
let fclone = f.clone();
|
||||
let p = p.on_get(move |a, pinfo| {
|
||||
let minfo = pinfo.to_method_info();
|
||||
let d = fclone(&minfo);
|
||||
a.append(d.captcha_error_details()?);
|
||||
Ok(())
|
||||
});
|
||||
let i = i.add_p(p);
|
||||
i
|
||||
}
|
Reference in New Issue
Block a user