aboutsummaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-11-24 08:17:38 +0100
committerdefault <nobody@localhost>2024-11-24 08:17:38 +0100
commit7287776fd1f659619e211ee482ba0d6d64ddbf0b (patch)
tree26d4c501947a86d294080730db38ee052ce658d3 /activitypub.c
parent35b35ec3afff47be872004448e6ba81a6a339131 (diff)
New function pending_add().
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/activitypub.c b/activitypub.c
index 649b1f2..3ab093f 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1927,22 +1927,31 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req)
object_add(actor, actor_obj);
}
- xs *f_msg = xs_dup(msg);
- xs *reply = msg_accept(snac, f_msg, actor);
+ if (xs_is_true(xs_dict_get(snac->config, "approve_followers"))) {
+ pending_add(snac, actor, msg);
- post_message(snac, actor, reply);
-
- if (xs_is_null(xs_dict_get(f_msg, "published"))) {
- /* add a date if it doesn't include one (Mastodon) */
- xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
- f_msg = xs_dict_set(f_msg, "published", date);
+ snac_log(snac, xs_fmt("new pending follower approval %s", actor));
}
+ else {
+ /* automatic following */
+ xs *f_msg = xs_dup(msg);
+ xs *reply = msg_accept(snac, f_msg, actor);
- timeline_add(snac, id, f_msg);
+ post_message(snac, actor, reply);
+
+ if (xs_is_null(xs_dict_get(f_msg, "published"))) {
+ /* add a date if it doesn't include one (Mastodon) */
+ xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
+ f_msg = xs_dict_set(f_msg, "published", date);
+ }
- follower_add(snac, actor);
+ timeline_add(snac, id, f_msg);
+
+ follower_add(snac, actor);
+
+ snac_log(snac, xs_fmt("new follower %s", actor));
+ }
- snac_log(snac, xs_fmt("new follower %s", actor));
do_notify = 1;
}
else