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