commit 4819c42
default
·
2022-12-02 19:39:31 +0000 UTC
parent 67d5725
More old code deletions.
M
data.c
+1,
-38
1@@ -791,49 +791,12 @@ d_char *timeline_find(snac *snac, char *id)
2 int timeline_del(snac *snac, char *id)
3 /* deletes a message from the timeline */
4 {
5- int ret = 404;
6- xs *fn = _timeline_find_fn(snac, id);
7-
8- if (fn != NULL) {
9- xs *lfn = NULL;
10-
11- unlink(fn);
12- snac_debug(snac, 1, xs_fmt("timeline_del %s", id));
13-
14- /* try to delete also from the local timeline */
15- lfn = xs_replace(fn, "/timeline/", "/local/");
16-
17- if (unlink(lfn) != -1)
18- snac_debug(snac, 1, xs_fmt("timeline_del (local) %s", id));
19-
20- ret = 200;
21- }
22-
23 /* delete from the user's caches */
24 object_user_cache_del(snac, id, "public");
25 object_user_cache_del(snac, id, "private");
26
27 /* try to delete the object if it's not used elsewhere */
28- object_del_if_unref(id);
29-
30- return ret;
31-}
32-
33-
34-d_char *timeline_get(snac *snac, char *fn)
35-/* gets a timeline entry by file name */
36-{
37- d_char *d = NULL;
38- FILE *f;
39-
40- if ((f = fopen(fn, "r")) != NULL) {
41- xs *j = xs_readall(f);
42-
43- d = xs_json_loads(j);
44- fclose(f);
45- }
46-
47- return d;
48+ return object_del_if_unref(id);
49 }
50
51
M
html.c
+0,
-2
1@@ -1041,8 +1041,6 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
2
3 xs *list = timeline_list(&snac, "private", XS_ALL);
4
5- printf("--> %d\n", xs_list_len(list));
6-
7 *body = html_timeline(&snac, list, 0);
8 *b_size = strlen(*body);
9 status = 200;
M
snac.h
+0,
-1
1@@ -79,7 +79,6 @@ int timeline_here(snac *snac, char *id);
2 d_char *_timeline_find_fn(snac *snac, char *id);
3 d_char *timeline_find(snac *snac, char *id);
4 int timeline_del(snac *snac, char *id);
5-d_char *timeline_get(snac *snac, char *fn);
6 d_char *timeline_list(snac *snac, const char *idx_name, int max);
7 int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer);
8 void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like);