From f1f3e3b11631f0075597ff93f7b4775f3403d48e Mon Sep 17 00:00:00 2001 From: default Date: Mon, 20 Feb 2023 06:00:54 +0100 Subject: Email notifications can be disabled. --- activitypub.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'activitypub.c') 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", -- cgit v1.2.3