diff options
author | default <nobody@localhost> | 2024-01-14 15:08:54 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2024-01-14 15:08:54 +0100 |
commit | ee0c6386ccfda1efddf2f6aab6fa1cba0e51db4b (patch) | |
tree | 37e732f63432cc135088b852afa15a3826c8c12e /data.c | |
parent | 33a0386a1ee4aad045260b7dd36c6d4d5dea087c (diff) |
Ensure to now overwrite the Accept + Follow object on repeated follows.
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1206,6 +1206,19 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg) int ret = 201; /* created */ xs *fn = _following_fn(snac, actor); FILE *f; + xs *p_object = NULL; + + if (valid_status(following_get(snac, actor, &p_object))) { + /* object already exists; if it's of type Accept, + the actor is already being followed and confirmed, + so do nothing */ + char *type = xs_dict_get(p_object, "type"); + + if (!xs_is_null(type) && strcmp(type, "Accept") == 0) { + snac_debug(snac, 1, xs_fmt("following_add actor already confirmed %s", actor)); + return 200; + } + } if ((f = fopen(fn, "w")) != NULL) { xs_json_dump(msg, 4, f); |