65 lines
2.0 KiB
Rust
65 lines
2.0 KiB
Rust
#![allow(clippy::all)]
|
|
|
|
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Handler.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/channel_handler.rs`, see https://github.com/diwic/dbus-rs
|
|
use dbus;
|
|
use dbus::arg;
|
|
use dbus::tree;
|
|
|
|
pub trait ChannelHandler {
|
|
fn handle_channel(
|
|
&self,
|
|
bus_name: &str,
|
|
connection: dbus::Path,
|
|
channel_type: &str,
|
|
channel: dbus::Path,
|
|
handle_type: u32,
|
|
handle: u32,
|
|
) -> Result<(), tree::MethodErr>;
|
|
}
|
|
|
|
pub fn channel_handler_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,
|
|
T: AsRef<dyn ChannelHandler>,
|
|
F: 'static + Fn(&tree::MethodInfo<tree::MTFn<D>, D>) -> T,
|
|
{
|
|
let i = factory.interface("org.freedesktop.Telepathy.ChannelHandler", 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 bus_name: &str = i.read()?;
|
|
let connection: dbus::Path = i.read()?;
|
|
let channel_type: &str = i.read()?;
|
|
let channel: dbus::Path = i.read()?;
|
|
let handle_type: u32 = i.read()?;
|
|
let handle: u32 = i.read()?;
|
|
let dd = fclone(minfo);
|
|
let d = dd.as_ref();
|
|
d.handle_channel(
|
|
bus_name,
|
|
connection,
|
|
channel_type,
|
|
channel,
|
|
handle_type,
|
|
handle,
|
|
)?;
|
|
let rm = minfo.msg.method_return();
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("HandleChannel", Default::default(), h);
|
|
let m = m.in_arg(("Bus_Name", "s"));
|
|
let m = m.in_arg(("Connection", "o"));
|
|
let m = m.in_arg(("Channel_Type", "s"));
|
|
let m = m.in_arg(("Channel", "o"));
|
|
let m = m.in_arg(("Handle_Type", "u"));
|
|
let m = m.in_arg(("Handle", "u"));
|
|
let i = i.add_m(m);
|
|
i
|
|
}
|