Compare commits

...

7 Commits

3 changed files with 34 additions and 1 deletions

View File

@ -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";
@ -1952,6 +1954,23 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
else
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));
}

15
data.c
View File

@ -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));
}
}
}

View File

@ -388,6 +388,7 @@ void httpd_connection(FILE *f)
body, xs_dict_get(srv_config, "host"));
headers = xs_dict_append(headers, "WWW-Authenticate", www_auth);
headers = xs_dict_append(headers, "Cache-Control", "no-cache, must-revalidate, max-age=0");
}
if (ctype == NULL)