diff options
author | default <nobody@localhost> | 2023-02-20 06:00:54 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-02-20 06:00:54 +0100 |
commit | f1f3e3b11631f0075597ff93f7b4775f3403d48e (patch) | |
tree | 2a0056e29117affe8bbe052fb732bb687b936970 | |
parent | a3804c2c89482652b270f43d21e70eff63dc76d1 (diff) |
Email notifications can be disabled.
-rw-r--r-- | activitypub.c | 14 | ||||
-rw-r--r-- | html.c | 14 |
2 files changed, 23 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c index 02a89d6..4db08ab 100644 --- a/activitypub.c +++ b/activitypub.c @@ -838,9 +838,19 @@ void notify(snac *snac, xs_str *type, xs_str *utype, xs_str *actor, xs_dict *msg /* email */ - char *email = xs_dict_get(snac->config, "email"); + const char *email = "[disabled by admin]"; - if (!xs_is_null(email) && *email != '\0') { + if (xs_type(xs_dict_get(srv_config, "disable_email_notifications")) != XSTYPE_TRUE) { + email = xs_dict_get(snac->config_o, "email"); + if (xs_is_null(email)) { + email = xs_dict_get(snac->config, "email"); + + if (xs_is_null(email)) + email = "[empty]"; + } + } + + if (*email != '[') { snac_debug(snac, 1, xs_fmt("email notify %s %s %s", type, utype, actor)); xs *subject = xs_fmt("snac notify for @%s@%s", @@ -327,9 +327,17 @@ d_char *html_top_controls(snac *snac, d_char *s) "</div>\n" "</div>\n"; - char *email = xs_dict_get(snac->config, "email"); - if (xs_is_null(email)) - email = ""; + const char *email = "[disabled by admin]"; + + if (xs_type(xs_dict_get(srv_config, "disable_email_notifications")) != XSTYPE_TRUE) { + email = xs_dict_get(snac->config_o, "email"); + if (xs_is_null(email)) { + email = xs_dict_get(snac->config, "email"); + + if (xs_is_null(email)) + email = ""; + } + } char *cw = xs_dict_get(snac->config, "cw"); if (xs_is_null(cw)) |