commit 93d1649

default  ·  2023-05-17 09:24:47 +0000 UTC
parent 6a2979c
New config option 'drop_dm_from_unknown'.
1 files changed,  +10, -0
+10, -0
 1@@ -1045,6 +1045,16 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
 2         return 1;
 3     }
 4 
 5+    /* if it's a DM from someone we don't follow, reject the message */
 6+    if (xs_type(xs_dict_get(snac->config, "drop_dm_from_unknown")) == XSTYPE_TRUE) {
 7+        if (strcmp(utype, "Note") == 0 && !is_msg_public(snac, msg) &&
 8+            !following_check(snac, actor)) {
 9+            snac_log(snac, xs_fmt("DM rejected from unknown actor %s", actor));
10+
11+            return 1;
12+        }
13+    }
14+
15     /* bring the actor */
16     a_status = actor_request(snac, actor, &actor_o);
17