diff --git a/src/padfoot/connection/contact_list.rs b/src/padfoot/connection/contact_list.rs index 7cc32df..8b3bc98 100644 --- a/src/padfoot/connection/contact_list.rs +++ b/src/padfoot/connection/contact_list.rs @@ -2,8 +2,9 @@ use crate::padfoot::VarArg; use crate::telepathy; use dbus::tree::MethodErr; -use deltachat::constants::DC_GCL_ADD_SELF; -use deltachat::contact::Contact; +use dc::constants::DC_GCL_ADD_SELF; +use dc::contact::Contact; +use deltachat as dc; use std::collections::HashMap; use std::convert::TryInto; use telepathy::ConnectionInterfaceContacts; // for get_contact_attributes @@ -63,6 +64,19 @@ impl telepathy::ConnectionInterfaceContactList for Connection { } fn remove_contacts(&self, contacts: Vec) -> Result<(), MethodErr> { println!("Connection<{}>::remove_contacts({:?})", self.id(), contacts); + + let ctx = self.ctx.read().unwrap(); + + for contact_id in contacts { + // FIXME: don't ignore errors + if let Err(e) = Contact::delete(&ctx, contact_id) { + println!(" Deleting contact {} failed: {}", contact_id, e); + } + } + + // FIXME: signals MUST be emitted before this method returns + // FIXME: emitting signals at all would be great + Ok(()) } fn unsubscribe(&self, contacts: Vec) -> Result<(), MethodErr> {