There was also a lot of unneeded overhead in Connection::new() to get the path to compare against, so split that out into a settings struct
108 lines
3.3 KiB
Rust
108 lines
3.3 KiB
Rust
use crate::telepathy;
|
|
|
|
use dbus::tree::MethodErr;
|
|
use std::collections::HashMap;
|
|
|
|
use super::Connection;
|
|
|
|
impl AsRef<dyn telepathy::ConnectionInterfaceAvatars + 'static> for std::rc::Rc<Connection> {
|
|
fn as_ref(&self) -> &(dyn telepathy::ConnectionInterfaceAvatars + 'static) {
|
|
&**self
|
|
}
|
|
}
|
|
|
|
type AvatarRequirementSpec = (Vec<String>, u16, u16, u16, u16, u32);
|
|
|
|
// TODO: come back and do this properly, I'm just putting it in for consistency
|
|
impl telepathy::ConnectionInterfaceAvatars for Connection {
|
|
fn get_avatar_requirements(&self) -> Result<AvatarRequirementSpec, MethodErr> {
|
|
println!("Connection<{}>::get_avatar_requirements()", self.id());
|
|
Ok((vec![], 0, 0, 0, 0, 0))
|
|
}
|
|
|
|
fn get_avatar_tokens(&self, contacts: Vec<u32>) -> Result<Vec<String>, MethodErr> {
|
|
println!(
|
|
"Connection<{}>::get_avatar_tokens({:?})",
|
|
self.id(),
|
|
contacts
|
|
);
|
|
Ok(vec![])
|
|
}
|
|
|
|
fn get_known_avatar_tokens(
|
|
&self,
|
|
contacts: Vec<u32>,
|
|
) -> Result<::std::collections::HashMap<u32, String>, MethodErr> {
|
|
println!(
|
|
"Connection<{}>::get_known_avatar_tokens({:?})",
|
|
self.id(),
|
|
contacts
|
|
);
|
|
Ok(HashMap::<u32, String>::new())
|
|
}
|
|
|
|
fn request_avatar(&self, contact: u32) -> Result<(Vec<u8>, String), MethodErr> {
|
|
println!("Connection<{}>::request_avatar({})", self.id(), contact);
|
|
Ok((vec![], "".to_string()))
|
|
}
|
|
|
|
fn request_avatars(&self, contacts: Vec<u32>) -> Result<(), MethodErr> {
|
|
println!("Connection<{}>::request_avatar({:?})", self.id(), contacts);
|
|
Ok(())
|
|
}
|
|
|
|
fn set_avatar(&self, _avatar: Vec<u8>, mimetype: &str) -> Result<String, MethodErr> {
|
|
println!(
|
|
"Connection<{}>::set_avatar((data), {:?})",
|
|
self.id(),
|
|
mimetype
|
|
);
|
|
Ok("".to_string())
|
|
}
|
|
|
|
fn clear_avatar(&self) -> Result<(), MethodErr> {
|
|
println!("Connection<{}>::clear_avatar()", self.id());
|
|
Ok(())
|
|
}
|
|
|
|
fn supported_avatar_mimetypes(&self) -> Result<Vec<String>, MethodErr> {
|
|
println!("Connection<{}>::supported_avatar_mimetypes()", self.id());
|
|
Ok(vec![])
|
|
}
|
|
|
|
fn minimum_avatar_height(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::minimum_avatar_height()", self.id());
|
|
Ok(0)
|
|
}
|
|
|
|
fn minimum_avatar_width(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::minimum_avatar_width()", self.id());
|
|
Ok(0)
|
|
}
|
|
|
|
fn recommended_avatar_height(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::recommended_avatar_height()", self.id());
|
|
Ok(0)
|
|
}
|
|
|
|
fn recommended_avatar_width(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::recommended_avatar_width()", self.id());
|
|
Ok(0)
|
|
}
|
|
|
|
fn maximum_avatar_height(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::maximum_avatar_height()", self.id());
|
|
Ok(0)
|
|
}
|
|
|
|
fn maximum_avatar_width(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::maximum_avatar_width()", self.id());
|
|
Ok(0)
|
|
}
|
|
|
|
fn maximum_avatar_bytes(&self) -> Result<u32, MethodErr> {
|
|
println!("Connection<{}>::maximum_avatar_bytes()", self.id());
|
|
Ok(0)
|
|
}
|
|
}
|