50 lines
1.6 KiB
Rust
50 lines
1.6 KiB
Rust
use crate::telepathy;
|
|
|
|
use dbus::arg::{RefArg, Variant};
|
|
use dbus::tree::MethodErr;
|
|
use std::collections::HashMap;
|
|
|
|
use super::Connection;
|
|
|
|
// TODO: extract a utility module for this?
|
|
type VarArg = Variant<Box<dyn RefArg + 'static>>;
|
|
|
|
impl AsRef<dyn telepathy::ConnectionInterfaceRequests + 'static> for std::rc::Rc<Connection> {
|
|
fn as_ref(&self) -> &(dyn telepathy::ConnectionInterfaceRequests + 'static) {
|
|
&**self
|
|
}
|
|
}
|
|
|
|
type ChannelSpec = (dbus::Path<'static>, HashMap<String, VarArg>);
|
|
|
|
type RequestableChannelSpec = (HashMap<String, VarArg>, Vec<String>);
|
|
|
|
impl telepathy::ConnectionInterfaceRequests for Connection {
|
|
fn create_channel(
|
|
&self,
|
|
request: HashMap<&str, VarArg>,
|
|
) -> Result<(dbus::Path<'static>, HashMap<String, VarArg>), MethodErr> {
|
|
println!("Connection<{}>::create_channel({:?})", self.id, request);
|
|
|
|
Err(MethodErr::no_arg()) // FIXME: should be NotImplemented?
|
|
}
|
|
|
|
fn ensure_channel(
|
|
&self,
|
|
request: HashMap<&str, VarArg>,
|
|
) -> Result<(bool, dbus::Path<'static>, HashMap<String, VarArg>), MethodErr> {
|
|
println!("Connection<{}>::ensure_channel({:?})", self.id, request);
|
|
Err(MethodErr::no_arg()) // FIXME: should be NotImplemented?
|
|
}
|
|
|
|
fn channels(&self) -> Result<Vec<ChannelSpec>, MethodErr> {
|
|
println!("Connection<{}>::channels()", self.id);
|
|
Ok(vec![])
|
|
}
|
|
|
|
fn requestable_channel_classes(&self) -> Result<Vec<RequestableChannelSpec>, MethodErr> {
|
|
println!("Connection<{}>::requestable_channel_classes()", self.id);
|
|
Ok(crate::padfoot::requestables())
|
|
}
|
|
}
|