diff --git a/README.md b/README.md index d296d77..0e62c69 100644 --- a/README.md +++ b/README.md @@ -182,10 +182,11 @@ whitespace! This bit is still extremely janky; it should instead be a magic channel type or action button of some kind. It is, however, functional. -Delta wants us to enable the "Send copy to self" option in settings, but that -isn't exposed in padfoot yet, so messages you send from padfoot won't appear in -other clients. Messages from other clients won't appear either, because messages -from yourself are mostly ingnored by padfoot. Still, it's progress. +Delta wants us to enable the "Send copy to self" option in settings. That's +exposed as "Bcc self" in the advanced options in Empathy. Once enabled, messages +you send via Padfoot will appear in other clients. However, messages you send +from other clients don't appear in Padfoot yet because it mostly ignores self +messages as a dirty hack to avoid double-showing messages. Progess though. ### Autogenerated telepathy DBUS bindings diff --git a/share/telepathy/managers/padfoot.manager b/share/telepathy/managers/padfoot.manager index 3982731..4f35814 100644 --- a/share/telepathy/managers/padfoot.manager +++ b/share/telepathy/managers/padfoot.manager @@ -7,6 +7,7 @@ ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/padfoot [Protocol delta] param-account=s required param-password=s required secret +param-bcc-self=b status-available=2 settable status-offline = 1 settable diff --git a/src/padfoot/connection.rs b/src/padfoot/connection.rs index 72b7440..f8b7466 100644 --- a/src/padfoot/connection.rs +++ b/src/padfoot/connection.rs @@ -75,6 +75,7 @@ pub struct Connection { pub struct ConnSettings { account: String, password: String, + bcc_self: bool, id: String, } @@ -100,9 +101,24 @@ impl ConnSettings { None => return err, }; + let bcc_self = match params.get("bcc-self") { + Some(variant) => match variant.0.as_u64() { + Some(i) => i != 0, + None => { + println!("0!"); + return err; + } + }, + None => { + println!("1!"); + false + } + }; + Ok(Self { account, password, + bcc_self, id, }) } @@ -211,8 +227,14 @@ impl Connection { .map_err(|_e| MethodErr::no_arg())?; ctx.set_config(Config::MailPw, Some(&settings.password)) .map_err(|_e| MethodErr::no_arg())?; - ctx.set_config(Config::SentboxWatch, Some(&"Sent")) - .map_err(|_e| MethodErr::no_arg())?; + + if settings.bcc_self { + ctx.set_config(Config::BccSelf, Some(&"1")) + .map_err(|_e| MethodErr::no_arg())?; + } else { + ctx.set_config(Config::BccSelf, Some(&"0")) + .map_err(|_e| MethodErr::no_arg())?; + } if !ctx.is_configured() { ctx.configure(); diff --git a/src/padfoot/protocol.rs b/src/padfoot/protocol.rs index 566ee89..82dfcde 100644 --- a/src/padfoot/protocol.rs +++ b/src/padfoot/protocol.rs @@ -1,4 +1,4 @@ -use crate::padfoot::{var_str, var_u32, VarArg}; +use crate::padfoot::{var_bool, var_str, var_u32, VarArg}; use crate::telepathy; use dbus::tree::MethodErr; @@ -49,6 +49,7 @@ pub fn parameters() -> Vec { "s".to_string(), var_str("".to_string()), ), + ("bcc-self".to_string(), 0, "b".to_string(), var_bool(false)), ] }