Support the "BCC self" option

This commit is contained in:
2021-01-10 18:08:22 +00:00
parent 83488c31fe
commit 4484f51c5d
3 changed files with 18 additions and 0 deletions

View File

@@ -32,6 +32,8 @@ _transpose_config(dc_context_t *mailbox, PurpleAccount *acct)
const char *smtp_pass = purple_account_get_string(acct, PLUGIN_ACCOUNT_OPT_SMTP_PASS, NULL);
const char *smtp_port = purple_account_get_string(acct, PLUGIN_ACCOUNT_OPT_SMTP_SERVER_PORT, NULL);
gboolean bcc_self = purple_account_get_bool(acct, PLUGIN_ACCOUNT_OPT_BCC_SELF, FALSE);
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_ADDR, addr);
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_DISPLAY_NAME, display);
@@ -44,6 +46,12 @@ _transpose_config(dc_context_t *mailbox, PurpleAccount *acct)
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_SMTP_USER, smtp_user);
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_SMTP_PASS, smtp_pass);
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_SMTP_SERVER_PORT, smtp_port);
if (bcc_self) {
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_BCC_SELF, "1");
} else {
dc_set_config(mailbox, PLUGIN_ACCOUNT_OPT_BCC_SELF, "0");
};
}
typedef struct {

View File

@@ -72,6 +72,12 @@ pwd_opt(const char *text, const char *name, const char *def)
return option;
}
static PurpleAccountOption *
bool_opt(const char *text, const char *name, const gboolean def)
{
return purple_account_option_bool_new(text, name, def);
}
static void
delta_init_plugin(PurplePlugin *plugin)
{
@@ -98,6 +104,8 @@ delta_init_plugin(PurplePlugin *plugin)
// Not exposed: server_flags, selfstatus, e2ee_enabled
// https://deltachat.github.io/api/classmrmailbox__t.html
opts = g_list_prepend(opts, bool_opt("Send copy to self", PLUGIN_ACCOUNT_OPT_BCC_SELF, FALSE));
extra->protocol_options = g_list_reverse(opts);
}

View File

@@ -27,6 +27,8 @@
#define PLUGIN_ACCOUNT_OPT_SMTP_USER "send_user"
#define PLUGIN_ACCOUNT_OPT_SMTP_PASS "send_pw"
#define PLUGIN_ACCOUNT_OPT_BCC_SELF "bcc_self"
#define UNUSED(x) (void)(x)
#endif