diff options
-rw-r--r-- | activitypub.c | 19 | ||||
-rw-r--r-- | data.c | 15 |
2 files changed, 33 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c index 9a23e14..526302a 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1941,6 +1941,8 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) } else if (strcmp(type, "Undo") == 0) { /** **/ + char *id = xs_dict_get(object, "object"); + if (xs_type(object) != XSTYPE_DICT) utype = "Follow"; @@ -1953,6 +1955,23 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) snac_log(snac, xs_fmt("error deleting follower %s", actor)); } else + if (strcmp(utype, "Like") == 0) { /** **/ + int status = object_unadmire(id, actor, 1); + + snac_log(snac, xs_fmt("Unlike for %s %d", id, status)); + } + else + if (strcmp(utype, "Announce") == 0) { /** **/ + int status = 200; + + /* commented out: if a followed user boosts something that + is requested and then unboosts, the post remains here, + but with no apparent reason, and that is confusing */ + //status = object_unadmire(id, actor, 0); + + snac_log(snac, xs_fmt("Unboost for %s %d", id, status)); + } + else snac_debug(snac, 1, xs_fmt("ignored 'Undo' for object type '%s'", utype)); } else @@ -406,7 +406,7 @@ int index_del_md5(const char *fn, const char *md5) fclose(f); } else - status = 500; + status = 410; pthread_mutex_unlock(&data_mutex); @@ -917,6 +917,9 @@ int object_unadmire(const char *id, const char *actor, int like) status = index_del(fn, actor); + if (valid_status(status)) + index_gc(fn); + srv_debug(0, xs_fmt("object_unadmire (%s) %s %s %d", like ? "Like" : "Announce", actor, fn, status)); @@ -2743,6 +2746,16 @@ void purge_server(void) } } } + + /* delete index backups */ + xs *specb = xs_fmt("%s/" "*.bak", v); + xs *bakfs = xs_glob(specb, 0, 0); + + p2 = bakfs; + while (xs_list_iter(&p2, &v2)) { + unlink(v2); + srv_debug(1, xs_fmt("purged %s", v2)); + } } } |