diff options
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) | |||
| 1206 | int ret = 201; /* created */ | 1206 | int ret = 201; /* created */ |
| 1207 | xs *fn = _following_fn(snac, actor); | 1207 | xs *fn = _following_fn(snac, actor); |
| 1208 | FILE *f; | 1208 | FILE *f; |
| 1209 | xs *p_object = NULL; | ||
| 1210 | |||
| 1211 | if (valid_status(following_get(snac, actor, &p_object))) { | ||
| 1212 | /* object already exists; if it's of type Accept, | ||
| 1213 | the actor is already being followed and confirmed, | ||
| 1214 | so do nothing */ | ||
| 1215 | char *type = xs_dict_get(p_object, "type"); | ||
| 1216 | |||
| 1217 | if (!xs_is_null(type) && strcmp(type, "Accept") == 0) { | ||
| 1218 | snac_debug(snac, 1, xs_fmt("following_add actor already confirmed %s", actor)); | ||
| 1219 | return 200; | ||
| 1220 | } | ||
| 1221 | } | ||
| 1209 | 1222 | ||
| 1210 | if ((f = fopen(fn, "w")) != NULL) { | 1223 | if ((f = fopen(fn, "w")) != NULL) { |
| 1211 | xs_json_dump(msg, 4, f); | 1224 | xs_json_dump(msg, 4, f); |