Partial implementation of contact removal
Empathy needs you to cycle the connection before it notices.
This commit is contained in:
@@ -2,8 +2,9 @@ use crate::padfoot::VarArg;
|
|||||||
use crate::telepathy;
|
use crate::telepathy;
|
||||||
|
|
||||||
use dbus::tree::MethodErr;
|
use dbus::tree::MethodErr;
|
||||||
use deltachat::constants::DC_GCL_ADD_SELF;
|
use dc::constants::DC_GCL_ADD_SELF;
|
||||||
use deltachat::contact::Contact;
|
use dc::contact::Contact;
|
||||||
|
use deltachat as dc;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use telepathy::ConnectionInterfaceContacts; // for get_contact_attributes
|
use telepathy::ConnectionInterfaceContacts; // for get_contact_attributes
|
||||||
@@ -63,6 +64,19 @@ impl telepathy::ConnectionInterfaceContactList for Connection {
|
|||||||
}
|
}
|
||||||
fn remove_contacts(&self, contacts: Vec<u32>) -> Result<(), MethodErr> {
|
fn remove_contacts(&self, contacts: Vec<u32>) -> Result<(), MethodErr> {
|
||||||
println!("Connection<{}>::remove_contacts({:?})", self.id(), contacts);
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn unsubscribe(&self, contacts: Vec<u32>) -> Result<(), MethodErr> {
|
fn unsubscribe(&self, contacts: Vec<u32>) -> Result<(), MethodErr> {
|
||||||
|
Reference in New Issue
Block a user