This commit contains autogenerated telepathy DBUS code and the output of `cargo new telepathy-delta`. It's pretty chill.
156 lines
5.5 KiB
Rust
156 lines
5.5 KiB
Rust
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Connection_Interface_Contact_Info.xml -i org.freedesktop.Telepathy -o src/telepathy/connection_interface_contact_info.rs`, see https://github.com/diwic/dbus-rs
|
|
use dbus;
|
|
use dbus::arg;
|
|
use dbus::tree;
|
|
|
|
pub trait ConnectionInterfaceContactInfo {
|
|
fn get_contact_info(
|
|
&self,
|
|
contacts: Vec<u32>,
|
|
) -> Result<
|
|
::std::collections::HashMap<u32, Vec<(String, Vec<String>, Vec<String>)>>,
|
|
tree::MethodErr,
|
|
>;
|
|
fn refresh_contact_info(&self, contacts: Vec<u32>) -> Result<(), tree::MethodErr>;
|
|
fn request_contact_info(
|
|
&self,
|
|
contact: u32,
|
|
) -> Result<Vec<(String, Vec<String>, Vec<String>)>, tree::MethodErr>;
|
|
fn set_contact_info(
|
|
&self,
|
|
contact_info: Vec<(&str, Vec<&str>, Vec<&str>)>,
|
|
) -> Result<(), tree::MethodErr>;
|
|
fn contact_info_flags(&self) -> Result<u32, tree::MethodErr>;
|
|
fn supported_fields(&self) -> Result<Vec<(String, Vec<String>, u32, u32)>, tree::MethodErr>;
|
|
}
|
|
|
|
pub fn connection_interface_contact_info_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,
|
|
D::Signal: Default,
|
|
T: ConnectionInterfaceContactInfo,
|
|
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
|
|
{
|
|
let i = factory.interface(
|
|
"org.freedesktop.Telepathy.Connection.Interface.ContactInfo",
|
|
data,
|
|
);
|
|
let f = ::std::sync::Arc::new(f);
|
|
let fclone = f.clone();
|
|
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
|
let mut i = minfo.msg.iter_init();
|
|
let contacts: Vec<u32> = i.read()?;
|
|
let d = fclone(minfo);
|
|
let contact_info = d.get_contact_info(contacts)?;
|
|
let rm = minfo.msg.method_return();
|
|
let rm = rm.append1(contact_info);
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("GetContactInfo", Default::default(), h);
|
|
let m = m.in_arg(("Contacts", "au"));
|
|
let m = m.out_arg(("ContactInfo", "a{ua(sasas)}"));
|
|
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 contacts: Vec<u32> = i.read()?;
|
|
let d = fclone(minfo);
|
|
d.refresh_contact_info(contacts)?;
|
|
let rm = minfo.msg.method_return();
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("RefreshContactInfo", Default::default(), h);
|
|
let m = m.in_arg(("Contacts", "au"));
|
|
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 contact: u32 = i.read()?;
|
|
let d = fclone(minfo);
|
|
let contact_info = d.request_contact_info(contact)?;
|
|
let rm = minfo.msg.method_return();
|
|
let rm = rm.append1(contact_info);
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("RequestContactInfo", Default::default(), h);
|
|
let m = m.in_arg(("Contact", "u"));
|
|
let m = m.out_arg(("Contact_Info", "a(sasas)"));
|
|
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 contact_info: Vec<(&str, Vec<&str>, Vec<&str>)> = i.read()?;
|
|
let d = fclone(minfo);
|
|
d.set_contact_info(contact_info)?;
|
|
let rm = minfo.msg.method_return();
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("SetContactInfo", Default::default(), h);
|
|
let m = m.in_arg(("ContactInfo", "a(sasas)"));
|
|
let i = i.add_m(m);
|
|
|
|
let p = factory.property::<u32, _>("ContactInfoFlags", 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.contact_info_flags()?);
|
|
Ok(())
|
|
});
|
|
let i = i.add_p(p);
|
|
|
|
let p = factory
|
|
.property::<Vec<(&str, Vec<&str>, u32, u32)>, _>("SupportedFields", 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.supported_fields()?);
|
|
Ok(())
|
|
});
|
|
let i = i.add_p(p);
|
|
let s = factory.signal("ContactInfoChanged", Default::default());
|
|
let s = s.arg(("Contact", "u"));
|
|
let s = s.arg(("ContactInfo", "a(sasas)"));
|
|
let i = i.add_s(s);
|
|
i
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct ConnectionInterfaceContactInfoContactInfoChanged {
|
|
pub contact: u32,
|
|
pub contact_info: Vec<(String, Vec<String>, Vec<String>)>,
|
|
}
|
|
|
|
impl arg::AppendAll for ConnectionInterfaceContactInfoContactInfoChanged {
|
|
fn append(&self, i: &mut arg::IterAppend) {
|
|
arg::RefArg::append(&self.contact, i);
|
|
arg::RefArg::append(&self.contact_info, i);
|
|
}
|
|
}
|
|
|
|
impl arg::ReadAll for ConnectionInterfaceContactInfoContactInfoChanged {
|
|
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
|
|
Ok(ConnectionInterfaceContactInfoContactInfoChanged {
|
|
contact: i.read()?,
|
|
contact_info: i.read()?,
|
|
})
|
|
}
|
|
}
|
|
|
|
impl dbus::message::SignalArgs for ConnectionInterfaceContactInfoContactInfoChanged {
|
|
const NAME: &'static str = "ContactInfoChanged";
|
|
const INTERFACE: &'static str = "org.freedesktop.Telepathy.Connection.Interface.ContactInfo";
|
|
}
|