summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-05-17 11:24:47 +0200
committerdefault <nobody@localhost>2023-05-17 11:24:47 +0200
commit93d1649ba6f2c9acf9efb854208d7ea117af6026 (patch)
tree35af5f7f3fcc825fb95e19277359e401a455f5c0 /activitypub.c
parent6a2979c13195a5898dd184a70094285486000d52 (diff)
New config option 'drop_dm_from_unknown'.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c
index 39d1605..57c3259 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1045,6 +1045,16 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
return 1;
}
+ /* if it's a DM from someone we don't follow, reject the message */
+ if (xs_type(xs_dict_get(snac->config, "drop_dm_from_unknown")) == XSTYPE_TRUE) {
+ if (strcmp(utype, "Note") == 0 && !is_msg_public(snac, msg) &&
+ !following_check(snac, actor)) {
+ snac_log(snac, xs_fmt("DM rejected from unknown actor %s", actor));
+
+ return 1;
+ }
+ }
+
/* bring the actor */
a_status = actor_request(snac, actor, &actor_o);