Don't build a new connection if it already exists
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
This commit is contained in:
@@ -16,12 +16,16 @@ 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);
|
||||
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);
|
||||
println!(
|
||||
"Connection<{}>::get_avatar_tokens({:?})",
|
||||
self.id(),
|
||||
contacts
|
||||
);
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
@@ -31,71 +35,73 @@ impl telepathy::ConnectionInterfaceAvatars for Connection {
|
||||
) -> Result<::std::collections::HashMap<u32, String>, MethodErr> {
|
||||
println!(
|
||||
"Connection<{}>::get_known_avatar_tokens({:?})",
|
||||
self.id, contacts
|
||||
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);
|
||||
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);
|
||||
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
|
||||
self.id(),
|
||||
mimetype
|
||||
);
|
||||
Ok("".to_string())
|
||||
}
|
||||
|
||||
fn clear_avatar(&self) -> Result<(), MethodErr> {
|
||||
println!("Connection<{}>::clear_avatar()", self.id);
|
||||
println!("Connection<{}>::clear_avatar()", self.id());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn supported_avatar_mimetypes(&self) -> Result<Vec<String>, MethodErr> {
|
||||
println!("Connection<{}>::supported_avatar_mimetypes()", self.id);
|
||||
println!("Connection<{}>::supported_avatar_mimetypes()", self.id());
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
fn minimum_avatar_height(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::minimum_avatar_height()", self.id);
|
||||
println!("Connection<{}>::minimum_avatar_height()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn minimum_avatar_width(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::minimum_avatar_width()", self.id);
|
||||
println!("Connection<{}>::minimum_avatar_width()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn recommended_avatar_height(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::recommended_avatar_height()", self.id);
|
||||
println!("Connection<{}>::recommended_avatar_height()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn recommended_avatar_width(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::recommended_avatar_width()", self.id);
|
||||
println!("Connection<{}>::recommended_avatar_width()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn maximum_avatar_height(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::maximum_avatar_height()", self.id);
|
||||
println!("Connection<{}>::maximum_avatar_height()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn maximum_avatar_width(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::maximum_avatar_width()", self.id);
|
||||
println!("Connection<{}>::maximum_avatar_width()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
fn maximum_avatar_bytes(&self) -> Result<u32, MethodErr> {
|
||||
println!("Connection<{}>::maximum_avatar_bytes()", self.id);
|
||||
println!("Connection<{}>::maximum_avatar_bytes()", self.id());
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user