Finish implementing the Contacts interface
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::telepathy;
|
|||||||
|
|
||||||
use dbus::arg::{RefArg, Variant};
|
use dbus::arg::{RefArg, Variant};
|
||||||
use dbus::tree::MethodErr;
|
use dbus::tree::MethodErr;
|
||||||
use deltachat::contact::Contact;
|
use deltachat::contact::{Contact, Origin};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use super::Connection;
|
use super::Connection;
|
||||||
@@ -80,7 +80,22 @@ impl telepathy::ConnectionInterfaceContacts for Connection {
|
|||||||
identifier,
|
identifier,
|
||||||
interfaces
|
interfaces
|
||||||
);
|
);
|
||||||
Err(MethodErr::no_arg()) // FIXME: should be NotImplemented?
|
|
||||||
|
let id = {
|
||||||
|
let ctx = &self.ctx.read().unwrap();
|
||||||
|
Contact::lookup_id_by_addr(ctx, identifier, Origin::Unknown)
|
||||||
|
};
|
||||||
|
|
||||||
|
if id == 0 {
|
||||||
|
return Err(MethodErr::no_arg()); // FIXME: should be InvalidHandle
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut contacts = self.get_contact_attributes(vec![id], interfaces, true)?;
|
||||||
|
if let Some(contact) = contacts.remove(&id) {
|
||||||
|
Ok((id, contact))
|
||||||
|
} else {
|
||||||
|
Err(MethodErr::no_arg()) // FIXME: should be InvalidHandle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contact_attribute_interfaces(&self) -> Result<Vec<String>, MethodErr> {
|
fn contact_attribute_interfaces(&self) -> Result<Vec<String>, MethodErr> {
|
||||||
|
Reference in New Issue
Block a user