Permalink
Browse files

refactored some of the forum json code and enabled the chat ep

  • Loading branch information...
1 parent 532699f commit 13b365addb78cfa53e0c4d29632d9b1117041162 @public committed Nov 29, 2011
Showing with 8 additions and 13 deletions.
  1. +1 −3 raas/src/entrypoints/enabled.h
  2. +7 −10 raas/src/entrypoints/forums.cc
@@ -3,6 +3,7 @@
namespace rsweb {
void ep_friends(evhttp_request*);
void ep_global_chat(evhttp_request*);
+void ep_im_chat(evhttp_request*);
void ep_static_files(evhttp_request*);
void ep_file_share_browse(evhttp_request*);
void ep_forum_index(evhttp_request*);
@@ -21,9 +22,6 @@ static void ep_http_500(evhttp_request* req) {
evbuffer_free(resp);
}
-
-
-
static void ep_http_404(evhttp_request* req) {
struct evbuffer* resp = evbuffer_new();
evbuffer_add_printf(resp, "404 :(\n%s", evhttp_request_get_uri(req));
@@ -28,16 +28,13 @@ void ep_forum_index(evhttp_request* req) {
auto jroot = json_object();
json_object_set_new(jroot, "forums", json_forum_list);
- // dump the json out
- struct evbuffer* resp = evbuffer_new();
- json_dump_evbuffer(jroot, resp, JSON_INDENT(4));
- json_object_clear(jroot);
- json_decref(jroot);
-
- struct evkeyvalq* headers = evhttp_request_get_output_headers(req);
- evhttp_add_header(headers, "Content-Type", "text/plain");
- evhttp_send_reply(req, 200, "OK", resp);
- evbuffer_free(resp);
+ return evhttp_send_json_reply(req, jroot);
+}
+
+void ep_forum_create(evhttp_request* req) {
+ // FIXME: actually create the forum and return something useful
+ auto jroot = json_object();
+ return evhttp_send_json_reply(req, jroot);
}
void ep_forum_thread_GET(evhttp_request* req) {

0 comments on commit 13b365a

Please sign in to comment.