More old code deletions.

This commit is contained in:
default 2022-12-02 20:39:31 +01:00
parent 67d57252ea
commit 4819c4248d
3 changed files with 1 additions and 41 deletions

39
data.c
View File

@ -791,49 +791,12 @@ d_char *timeline_find(snac *snac, char *id)
int timeline_del(snac *snac, char *id)
/* deletes a message from the timeline */
{
int ret = 404;
xs *fn = _timeline_find_fn(snac, id);
if (fn != NULL) {
xs *lfn = NULL;
unlink(fn);
snac_debug(snac, 1, xs_fmt("timeline_del %s", id));
/* try to delete also from the local timeline */
lfn = xs_replace(fn, "/timeline/", "/local/");
if (unlink(lfn) != -1)
snac_debug(snac, 1, xs_fmt("timeline_del (local) %s", id));
ret = 200;
}
/* delete from the user's caches */
object_user_cache_del(snac, id, "public");
object_user_cache_del(snac, id, "private");
/* try to delete the object if it's not used elsewhere */
object_del_if_unref(id);
return ret;
}
d_char *timeline_get(snac *snac, char *fn)
/* gets a timeline entry by file name */
{
d_char *d = NULL;
FILE *f;
if ((f = fopen(fn, "r")) != NULL) {
xs *j = xs_readall(f);
d = xs_json_loads(j);
fclose(f);
}
return d;
return object_del_if_unref(id);
}

2
html.c
View File

@ -1041,8 +1041,6 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
xs *list = timeline_list(&snac, "private", XS_ALL);
printf("--> %d\n", xs_list_len(list));
*body = html_timeline(&snac, list, 0);
*b_size = strlen(*body);
status = 200;

1
snac.h
View File

@ -79,7 +79,6 @@ int timeline_here(snac *snac, char *id);
d_char *_timeline_find_fn(snac *snac, char *id);
d_char *timeline_find(snac *snac, char *id);
int timeline_del(snac *snac, char *id);
d_char *timeline_get(snac *snac, char *fn);
d_char *timeline_list(snac *snac, const char *idx_name, int max);
int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer);
void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like);