diff options
author | default <nobody@localhost> | 2022-12-15 16:37:34 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2022-12-15 16:37:34 +0100 |
commit | df612873d6223477e5952e7a301f201117554599 (patch) | |
tree | 1edb51d81b39c30a47d98f86471ea7eaf9e5a6f8 /activitypub.c | |
parent | 32eb3fb041eeb53ee3aec23e991369e280d6ef81 (diff) |
Log repeated Follow messages.
Diffstat (limited to 'activitypub.c')
-rw-r--r-- | activitypub.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/activitypub.c b/activitypub.c index 4309da9..9131b2b 100644 --- a/activitypub.c +++ b/activitypub.c @@ -823,23 +823,27 @@ int process_message(snac *snac, char *msg, char *req) } if (strcmp(type, "Follow") == 0) { - xs *f_msg = xs_dup(msg); - xs *reply = msg_accept(snac, f_msg, actor); + if (!follower_check(snac, actor)) { + xs *f_msg = xs_dup(msg); + xs *reply = msg_accept(snac, f_msg, actor); - post(snac, reply); + post(snac, 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, "%Y-%m-%dT%H:%M:%SZ"); - f_msg = xs_dict_set(f_msg, "published", date); - } + 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, "%Y-%m-%dT%H:%M:%SZ"); + f_msg = xs_dict_set(f_msg, "published", date); + } - timeline_add(snac, xs_dict_get(f_msg, "id"), f_msg, NULL, NULL); + timeline_add(snac, xs_dict_get(f_msg, "id"), f_msg, NULL, NULL); - follower_add(snac, actor); + follower_add(snac, actor); - snac_log(snac, xs_fmt("new follower %s", actor)); - do_notify = 1; + snac_log(snac, xs_fmt("new follower %s", actor)); + do_notify = 1; + } + else + snac_debug(snac, 1, xs_fmt("repeated 'Follow' from %s", actor)); } else if (strcmp(type, "Undo") == 0) { |