Backfill the Protocol interface
This commit is contained in:
@@ -34,7 +34,7 @@ Here's where we're at right now:
|
||||
- [x] Disconnect!
|
||||
- [ ] Set up an account manually
|
||||
- [ ] Contacts handling
|
||||
- [ ] Text messages
|
||||
- [~] Text messages
|
||||
- [ ] Multimedia messages
|
||||
- [ ] Setup messages
|
||||
- [ ] Import/Export
|
||||
|
@@ -1,7 +1,12 @@
|
||||
use crate::telepathy;
|
||||
use dbus::{arg, tree};
|
||||
|
||||
use dbus::arg;
|
||||
use dbus::tree::MethodErr;
|
||||
use deltachat as dc;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use super::ConnSettings;
|
||||
|
||||
pub const PROTO_OBJECT_PATH: &str = "/org/freedesktop/Telepathy/ConnectionManager/padfoot/delta";
|
||||
pub const PROTO_BUS_NAME: &str = "org.freedesktop.Telepathy.ConnectionManager.padfoot.delta";
|
||||
pub const PROTO_NAME: &str = "delta";
|
||||
@@ -79,62 +84,63 @@ impl AsRef<dyn telepathy::Protocol + 'static> for std::rc::Rc<Protocol> {
|
||||
}
|
||||
|
||||
impl telepathy::Protocol for Protocol {
|
||||
fn identify_account(&self, params: HashMap<&str, Variant>) -> Result<String, tree::MethodErr> {
|
||||
println!("Protocol::identify_account({:?})", params);
|
||||
fn identify_account(&self, params: HashMap<&str, Variant>) -> Result<String, MethodErr> {
|
||||
println!("Protocol::identify_account(...)");
|
||||
|
||||
Err(tree::MethodErr::no_arg())
|
||||
let settings = ConnSettings::from_params(params)?;
|
||||
|
||||
Ok(settings.id())
|
||||
}
|
||||
|
||||
fn normalize_contact(&self, contact_id: &str) -> Result<String, tree::MethodErr> {
|
||||
fn normalize_contact(&self, contact_id: &str) -> Result<String, MethodErr> {
|
||||
println!("Protocol::normalize_contact({})", contact_id);
|
||||
|
||||
Err(tree::MethodErr::no_arg())
|
||||
Ok(dc::contact::addr_normalize(contact_id).to_string())
|
||||
}
|
||||
|
||||
fn interfaces(&self) -> Result<Vec<String>, tree::MethodErr> {
|
||||
fn interfaces(&self) -> Result<Vec<String>, MethodErr> {
|
||||
println!("Protocol::interfaces()");
|
||||
|
||||
Ok(vec![])
|
||||
}
|
||||
fn parameters(&self) -> Result<Vec<ParamSpec>, tree::MethodErr> {
|
||||
|
||||
fn parameters(&self) -> Result<Vec<ParamSpec>, MethodErr> {
|
||||
println!("Protocol::parameters()");
|
||||
|
||||
Ok(parameters())
|
||||
}
|
||||
|
||||
fn connection_interfaces(&self) -> Result<Vec<String>, tree::MethodErr> {
|
||||
fn connection_interfaces(&self) -> Result<Vec<String>, MethodErr> {
|
||||
println!("Protocol::connection_interfaces()");
|
||||
|
||||
Ok(vec![
|
||||
"org.freedesktop.Telepathy.Connection.Interface.Contacts".to_string(),
|
||||
"org.freedesktop.Telepathy.Connection.Interface.Requests".to_string(),
|
||||
])
|
||||
Ok(super::connection_interfaces())
|
||||
}
|
||||
fn requestable_channel_classes(&self) -> Result<Vec<RequestableChannelSpec>, tree::MethodErr> {
|
||||
|
||||
fn requestable_channel_classes(&self) -> Result<Vec<RequestableChannelSpec>, MethodErr> {
|
||||
println!("Protocol::requestable_channel_classes()");
|
||||
|
||||
Ok(requestables())
|
||||
}
|
||||
|
||||
fn vcard_field(&self) -> Result<String, tree::MethodErr> {
|
||||
fn vcard_field(&self) -> Result<String, MethodErr> {
|
||||
println!("Protocol::vcard_field()");
|
||||
|
||||
Ok("email".to_string())
|
||||
}
|
||||
|
||||
fn english_name(&self) -> Result<String, tree::MethodErr> {
|
||||
fn english_name(&self) -> Result<String, MethodErr> {
|
||||
println!("Protocol::english_name()");
|
||||
|
||||
Ok("Delta Chat".to_string())
|
||||
}
|
||||
|
||||
fn icon(&self) -> Result<String, tree::MethodErr> {
|
||||
fn icon(&self) -> Result<String, MethodErr> {
|
||||
println!("Protocol::icon()");
|
||||
|
||||
Ok("im-delta".to_string())
|
||||
}
|
||||
|
||||
fn authentication_types(&self) -> Result<Vec<String>, tree::MethodErr> {
|
||||
fn authentication_types(&self) -> Result<Vec<String>, MethodErr> {
|
||||
println!("Protocol::authentication_types()");
|
||||
|
||||
Ok(vec![
|
||||
|
Reference in New Issue
Block a user