summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-12-03 07:27:26 +0100
committerGravatar default2022-12-03 07:27:26 +0100
commitaf6d31ff83bfe1eb6f4d37c5623e35f149e9aee5 (patch)
treeccce0075e128768e49832e7f14c80cf4de37a8cc
parentShow stray parents in the origin. (diff)
downloadsnac2-af6d31ff83bfe1eb6f4d37c5623e35f149e9aee5.tar.gz
snac2-af6d31ff83bfe1eb6f4d37c5623e35f149e9aee5.tar.xz
snac2-af6d31ff83bfe1eb6f4d37c5623e35f149e9aee5.zip
New function timeline_simple_list().
-rw-r--r--RELEASE_NOTES.md2
-rw-r--r--activitypub.c2
-rw-r--r--data.c16
-rw-r--r--html.c6
-rw-r--r--snac.h1
5 files changed, 17 insertions, 10 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 27674e5..d8a7e3f 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,7 +4,7 @@
4 4
5A big disk layout rework, to make it more efficient when timelines get very big. Please take note that you must run `snac upgrade` when you install this version over an already existing one. 5A big disk layout rework, to make it more efficient when timelines get very big. Please take note that you must run `snac upgrade` when you install this version over an already existing one.
6 6
7Fixed HTML loose close tag (contributed by kensata). 7Fixed HTML loose close tag (contributed by kensanata).
8 8
9Fixed bug when closing sendmail pipe (contributed by jpgarcia and themusicgod1). 9Fixed bug when closing sendmail pipe (contributed by jpgarcia and themusicgod1).
10 10
diff --git a/activitypub.c b/activitypub.c
index f19774c..9ac6bed 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1094,7 +1094,7 @@ int activitypub_get_handler(d_char *req, char *q_path,
1094 else 1094 else
1095 if (strcmp(p_path, "outbox") == 0) { 1095 if (strcmp(p_path, "outbox") == 0) {
1096 xs *id = xs_fmt("%s/outbox", snac.actor); 1096 xs *id = xs_fmt("%s/outbox", snac.actor);
1097 xs *elems = timeline_list(&snac, "public", 20); 1097 xs *elems = timeline_simple_list(&snac, "public", 20);
1098 xs *list = xs_list_new(); 1098 xs *list = xs_list_new();
1099 msg = msg_collection(&snac, id); 1099 msg = msg_collection(&snac, id);
1100 char *p, *v; 1100 char *p, *v;
diff --git a/data.c b/data.c
index a2242e8..12ba447 100644
--- a/data.c
+++ b/data.c
@@ -839,8 +839,8 @@ d_char *timeline_top_level(d_char *list)
839} 839}
840 840
841 841
842d_char *timeline_list(snac *snac, const char *idx_name, int max) 842d_char *timeline_simple_list(snac *snac, const char *idx_name, int max)
843/* returns a timeline */ 843/* returns a timeline (with all entries) */
844{ 844{
845 int c_max; 845 int c_max;
846 846
@@ -851,8 +851,16 @@ d_char *timeline_list(snac *snac, const char *idx_name, int max)
851 if (max > c_max) 851 if (max > c_max)
852 max = c_max; 852 max = c_max;
853 853
854 xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name); 854 xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name);
855 xs *list = index_list_desc(idx, max); 855
856 return index_list_desc(idx, max);
857}
858
859
860d_char *timeline_list(snac *snac, const char *idx_name, int max)
861/* returns a timeline (only top level entries) */
862{
863 xs *list = timeline_simple_list(snac, idx_name, max);
856 864
857 return timeline_top_level(list); 865 return timeline_top_level(list);
858} 866}
diff --git a/html.c b/html.c
index 65ea5e1..3c5d0bc 100644
--- a/html.c
+++ b/html.c
@@ -549,8 +549,6 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
549 } 549 }
550 550
551 if (level == 0) { 551 if (level == 0) {
552 char *p;
553
554 s = xs_str_cat(s, "<div class=\"snac-post\">\n"); 552 s = xs_str_cat(s, "<div class=\"snac-post\">\n");
555 553
556 if (boosts == NULL) 554 if (boosts == NULL)
@@ -558,7 +556,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
558 556
559 if (xs_list_len(boosts)) { 557 if (xs_list_len(boosts)) {
560 /* if somebody boosted this, show as origin */ 558 /* if somebody boosted this, show as origin */
561 p = xs_list_get(boosts, 0); 559 char *p = xs_list_get(boosts, -1);
562 xs *actor_r = NULL; 560 xs *actor_r = NULL;
563 561
564 if (xs_list_in(boosts, snac->md5) != -1) { 562 if (xs_list_in(boosts, snac->md5) != -1) {
@@ -1096,7 +1094,7 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
1096 if (strcmp(p_path, ".rss") == 0) { 1094 if (strcmp(p_path, ".rss") == 0) {
1097 /* public timeline in RSS format */ 1095 /* public timeline in RSS format */
1098 d_char *rss; 1096 d_char *rss;
1099 xs *elems = timeline_list(&snac, "public", 20); 1097 xs *elems = timeline_simple_list(&snac, "public", 20);
1100 xs *bio = not_really_markdown(xs_dict_get(snac.config, "bio")); 1098 xs *bio = not_really_markdown(xs_dict_get(snac.config, "bio"));
1101 char *p, *v; 1099 char *p, *v;
1102 1100
diff --git a/snac.h b/snac.h
index 0d7ede1..1254584 100644
--- a/snac.h
+++ b/snac.h
@@ -79,6 +79,7 @@ d_char *follower_list(snac *snac);
79 79
80double timeline_mtime(snac *snac); 80double timeline_mtime(snac *snac);
81int timeline_del(snac *snac, char *id); 81int timeline_del(snac *snac, char *id);
82d_char *timeline_simple_list(snac *snac, const char *idx_name, int max);
82d_char *timeline_list(snac *snac, const char *idx_name, int max); 83d_char *timeline_list(snac *snac, const char *idx_name, int max);
83int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer); 84int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer);
84void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like); 85void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like);