commit 093f4af

default  ·  2024-03-08 04:41:08 +0000 UTC
parent c2fb2a4
Shortened the maximum conversation levels.

Set to a compilation define in MAX_CONVERSATION_LEVELS.
3 files changed,  +8, -3
M html.c
M snac.h
+1, -1
1@@ -310,7 +310,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
2 {
3     int status = 0;
4 
5-    if (level < 256 && !xs_is_null(*id)) {
6+    if (level < MAX_CONVERSATION_LEVELS && !xs_is_null(*id)) {
7         xs *msg = NULL;
8 
9         /* is the object already there? */
M html.c
+3, -2
 1@@ -1334,8 +1334,9 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
 2     }
 3 
 4     /* avoid too deep nesting, as it may be a loop */
 5-    if (level >= 256)
 6-        return NULL;
 7+    if (level >= MAX_CONVERSATION_LEVELS)
 8+        return xs_html_tag("mark",
 9+            xs_html_text(L("Truncated (too deep)")));
10 
11     if (strcmp(type, "Follow") == 0) {
12         return xs_html_tag("div",
M snac.h
+4, -0
 1@@ -16,6 +16,10 @@
 2 #define MAX_THREADS 256
 3 #endif
 4 
 5+#ifndef MAX_CONVERSATION_LEVELS
 6+#define MAX_CONVERSATION_LEVELS 48
 7+#endif
 8+
 9 extern double disk_layout;
10 extern xs_str *srv_basedir;
11 extern xs_dict *srv_config;