From 4819c4248dc54c05cd4db9f181b333c3fd05d03d Mon Sep 17 00:00:00 2001 From: default Date: Fri, 2 Dec 2022 20:39:31 +0100 Subject: [PATCH] More old code deletions. --- data.c | 39 +-------------------------------------- html.c | 2 -- snac.h | 1 - 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/data.c b/data.c index 7b3c56f..ecba921 100644 --- a/data.c +++ b/data.c @@ -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); } diff --git a/html.c b/html.c index d486139..43f064f 100644 --- a/html.c +++ b/html.c @@ -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; diff --git a/snac.h b/snac.h index 91e745e..4ac3ade 100644 --- a/snac.h +++ b/snac.h @@ -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);