}
+#if 0
+
+// This code implements the thread display code. The thread sorting algorithm is working nicely but we're trying
+// not to do rendering in the C server of webcit. Maybe move it into the server as "MSGS threaded" or something like that?
+
// Threaded view (recursive section)
//
void thread_o_print(struct ctdlsession *c, StrBuf *sj, struct mthread *m, int num_msgs, int where_parent_is, int nesting_level)
}
}
-#if 0
// Threaded view (entry point)
//
#endif
-// render one message (entire transaction)
+// render one message (entire transaction) FIXME EXTERMINATE
//
void html_render_one_message(struct http_transaction *h, struct ctdlsession *c, long msgnum)
{
-
StrBuf *sj = NewStrBuf();
StrBufAppendPrintf(sj, "<html><body>\r\n");
setup_for_forum_view(c); // FIXME way too inefficient to do this for every message !!!!!!!!!!!!!
return;
}
+
+// Fetch a single message and return it in JSON format for client-side rendering
+//
+void json_render_one_message(struct http_transaction *h, struct ctdlsession *c, long msgnum)
+{
+ JsonValue *j = NULL; // FIXME do something useful
+
+ StrBuf *sj = NewStrBuf();
+ SerializeJson(sj, j, 1); // '1' == free the source object
+
+ add_response_header(h, strdup("Content-type"), strdup("application/json"));
+ h->response_code = 200;
+ h->response_string = strdup("OK");
+ h->response_body_length = StrLength(sj);
+ h->response_body = SmashStrBuf(&sj);
+}