summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c39
-rw-r--r--html.c2
-rw-r--r--snac.h1
3 files changed, 1 insertions, 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)
791int timeline_del(snac *snac, char *id) 791int timeline_del(snac *snac, char *id)
792/* deletes a message from the timeline */ 792/* deletes a message from the timeline */
793{ 793{
794 int ret = 404;
795 xs *fn = _timeline_find_fn(snac, id);
796
797 if (fn != NULL) {
798 xs *lfn = NULL;
799
800 unlink(fn);
801 snac_debug(snac, 1, xs_fmt("timeline_del %s", id));
802
803 /* try to delete also from the local timeline */
804 lfn = xs_replace(fn, "/timeline/", "/local/");
805
806 if (unlink(lfn) != -1)
807 snac_debug(snac, 1, xs_fmt("timeline_del (local) %s", id));
808
809 ret = 200;
810 }
811
812 /* delete from the user's caches */ 794 /* delete from the user's caches */
813 object_user_cache_del(snac, id, "public"); 795 object_user_cache_del(snac, id, "public");
814 object_user_cache_del(snac, id, "private"); 796 object_user_cache_del(snac, id, "private");
815 797
816 /* try to delete the object if it's not used elsewhere */ 798 /* try to delete the object if it's not used elsewhere */
817 object_del_if_unref(id); 799 return object_del_if_unref(id);
818
819 return ret;
820}
821
822
823d_char *timeline_get(snac *snac, char *fn)
824/* gets a timeline entry by file name */
825{
826 d_char *d = NULL;
827 FILE *f;
828
829 if ((f = fopen(fn, "r")) != NULL) {
830 xs *j = xs_readall(f);
831
832 d = xs_json_loads(j);
833 fclose(f);
834 }
835
836 return d;
837} 800}
838 801
839 802
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 *
1041 1041
1042 xs *list = timeline_list(&snac, "private", XS_ALL); 1042 xs *list = timeline_list(&snac, "private", XS_ALL);
1043 1043
1044 printf("--> %d\n", xs_list_len(list));
1045
1046 *body = html_timeline(&snac, list, 0); 1044 *body = html_timeline(&snac, list, 0);
1047 *b_size = strlen(*body); 1045 *b_size = strlen(*body);
1048 status = 200; 1046 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);
79d_char *_timeline_find_fn(snac *snac, char *id); 79d_char *_timeline_find_fn(snac *snac, char *id);
80d_char *timeline_find(snac *snac, char *id); 80d_char *timeline_find(snac *snac, char *id);
81int timeline_del(snac *snac, char *id); 81int timeline_del(snac *snac, char *id);
82d_char *timeline_get(snac *snac, char *fn);
83d_char *timeline_list(snac *snac, const char *idx_name, int max); 82d_char *timeline_list(snac *snac, const char *idx_name, int max);
84int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer); 83int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer);
85void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like); 84void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like);