mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Ensure to now overwrite the Accept + Follow object on repeated follows.
This commit is contained in:
parent
33a0386a1e
commit
ee0c6386cc
1 changed files with 13 additions and 0 deletions
13
data.c
13
data.c
|
@ -1206,6 +1206,19 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg)
|
||||||
int ret = 201; /* created */
|
int ret = 201; /* created */
|
||||||
xs *fn = _following_fn(snac, actor);
|
xs *fn = _following_fn(snac, actor);
|
||||||
FILE *f;
|
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) {
|
if ((f = fopen(fn, "w")) != NULL) {
|
||||||
xs_json_dump(msg, 4, f);
|
xs_json_dump(msg, 4, f);
|
||||||
|
|
Loading…
Reference in a new issue