48 lines
1.5 KiB
Rust
48 lines
1.5 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
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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<(dbus::Path<'static>, HashMap<String, VarArg>)>, MethodErr> {
|
||
|
println!("Connection<{}>::channels()", self.id);
|
||
|
Ok(vec![])
|
||
|
}
|
||
|
|
||
|
fn requestable_channel_classes(
|
||
|
&self,
|
||
|
) -> Result<Vec<(HashMap<String, VarArg>, Vec<String>)>, MethodErr> {
|
||
|
println!("Connection<{}>::requestable_channel_classes()", self.id);
|
||
|
Ok(crate::padfoot::requestables())
|
||
|
}
|
||
|
}
|