diff options
| author | 2022-12-15 16:37:34 +0100 | |
|---|---|---|
| committer | 2022-12-15 16:37:34 +0100 | |
| commit | df612873d6223477e5952e7a301f201117554599 (patch) | |
| tree | 1edb51d81b39c30a47d98f86471ea7eaf9e5a6f8 /activitypub.c | |
| parent | Also show the 'updated' timestamp. (diff) | |
| download | snac2-df612873d6223477e5952e7a301f201117554599.tar.gz snac2-df612873d6223477e5952e7a301f201117554599.tar.xz snac2-df612873d6223477e5952e7a301f201117554599.zip | |
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) | |||
| 823 | } | 823 | } |
| 824 | 824 | ||
| 825 | if (strcmp(type, "Follow") == 0) { | 825 | if (strcmp(type, "Follow") == 0) { |
| 826 | xs *f_msg = xs_dup(msg); | 826 | if (!follower_check(snac, actor)) { |
| 827 | xs *reply = msg_accept(snac, f_msg, actor); | 827 | xs *f_msg = xs_dup(msg); |
| 828 | xs *reply = msg_accept(snac, f_msg, actor); | ||
| 828 | 829 | ||
| 829 | post(snac, reply); | 830 | post(snac, reply); |
| 830 | 831 | ||
| 831 | if (xs_is_null(xs_dict_get(f_msg, "published"))) { | 832 | if (xs_is_null(xs_dict_get(f_msg, "published"))) { |
| 832 | /* add a date if it doesn't include one (Mastodon) */ | 833 | /* add a date if it doesn't include one (Mastodon) */ |
| 833 | xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ"); | 834 | xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ"); |
| 834 | f_msg = xs_dict_set(f_msg, "published", date); | 835 | f_msg = xs_dict_set(f_msg, "published", date); |
| 835 | } | 836 | } |
| 836 | 837 | ||
| 837 | timeline_add(snac, xs_dict_get(f_msg, "id"), f_msg, NULL, NULL); | 838 | timeline_add(snac, xs_dict_get(f_msg, "id"), f_msg, NULL, NULL); |
| 838 | 839 | ||
| 839 | follower_add(snac, actor); | 840 | follower_add(snac, actor); |
| 840 | 841 | ||
| 841 | snac_log(snac, xs_fmt("new follower %s", actor)); | 842 | snac_log(snac, xs_fmt("new follower %s", actor)); |
| 842 | do_notify = 1; | 843 | do_notify = 1; |
| 844 | } | ||
| 845 | else | ||
| 846 | snac_debug(snac, 1, xs_fmt("repeated 'Follow' from %s", actor)); | ||
| 843 | } | 847 | } |
| 844 | else | 848 | else |
| 845 | if (strcmp(type, "Undo") == 0) { | 849 | if (strcmp(type, "Undo") == 0) { |