From: Art Cancro Date: Sun, 13 Feb 2022 21:53:26 +0000 (-0500) Subject: Skip/Goto are functionally complete. X-Git-Tag: v950~16 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=00fb7b038b3c0aaf08a15b103c2053c1efea1fd9;p=citadel.git Skip/Goto are functionally complete. --- diff --git a/webcit-ng/request.c b/webcit-ng/request.c index f11865bbd..20216a0ef 100644 --- a/webcit-ng/request.c +++ b/webcit-ng/request.c @@ -36,6 +36,13 @@ void do_412(struct http_transaction *h) { } +// Succeed with no output +void do_204(struct http_transaction *h) { + h->response_code = 204; + h->response_string = strdup("No content"); +} + + // We throw an HTTP error "502 bad gateway" when we need to connect to Citadel, but can't. void do_502(struct http_transaction *h) { h->response_code = 502; diff --git a/webcit-ng/room_functions.c b/webcit-ng/room_functions.c index c0c67569f..0a8b73c41 100644 --- a/webcit-ng/room_functions.c +++ b/webcit-ng/room_functions.c @@ -131,8 +131,15 @@ void read_room_info_banner(struct http_transaction *h, struct ctdlsession *c) { // Client is setting the "Last Read Pointer" (marking all messages as "seen" up to this message) void set_last_read_pointer(struct http_transaction *h, struct ctdlsession *c) { - syslog(LOG_DEBUG, "FIXME: set last read pointer"); - do_404(h); // FIXME do this + char cbuf[1024]; + ctdl_printf(c, "SLRP %d", atoi(get_url_param(h, "last"))); + ctdl_readline(c, cbuf, sizeof(cbuf)); + if (cbuf[0] == '2') { + do_204(h); + } + else { + do_404(h); + } } diff --git a/webcit-ng/static/index.html b/webcit-ng/static/index.html index 2db6bf63a..ddada3564 100644 --- a/webcit-ng/static/index.html +++ b/webcit-ng/static/index.html @@ -32,7 +32,7 @@ LOADING - + Login diff --git a/webcit-ng/static/js/main.js b/webcit-ng/static/js/main.js index ba8dfb025..cc4627b71 100644 --- a/webcit-ng/static/js/main.js +++ b/webcit-ng/static/js/main.js @@ -106,9 +106,8 @@ function gotoroom(roomname) { // Goto next room with unread messages // which_oper is 0=ungoto, 1=skip, 2=goto function gotonext(which_oper) { - if (which_oper == 2) { // Goto needs to mark messages as seen - console.log("FIXME set lrp to " + last_seen); + set_last_read_pointer = async() => { response = await fetch("/ctdl/r/" + escapeHTMLURI(current_room) + "/slrp?last=" + last_seen); } @@ -157,7 +156,6 @@ function load_new_march_list(which_oper) { march_list.push({name:"_BASEROOM_",known:true,hasnewmsgs:true,floor:0}); } - console.log(march_list); gotonext(which_oper); } } diff --git a/webcit-ng/webcit.h b/webcit-ng/webcit.h index c98be4b71..17ffd0f23 100644 --- a/webcit-ng/webcit.h +++ b/webcit-ng/webcit.h @@ -116,13 +116,16 @@ enum { #define CLIENT_ID 4 #define TARGET "webcit02" /* Window target for inline URL's */ -void worker_entry(int *pointer_to_master_socket); +void worker_entry(int *); void perform_one_http_transaction(struct client_handle *ch); void add_response_header(struct http_transaction *h, char *key, char *val); void perform_request(struct http_transaction *); +void do_204(struct http_transaction *); void do_404(struct http_transaction *); +void do_412(struct http_transaction *); +void do_502(struct http_transaction *); void output_static(struct http_transaction *); -int uds_connectsock(char *sockpath); +int uds_connectsock(char *); void ctdl_a(struct http_transaction *, struct ctdlsession *); void ctdl_f(struct http_transaction *, struct ctdlsession *); void ctdl_r(struct http_transaction *, struct ctdlsession *); @@ -154,8 +157,5 @@ void ctdl_c(struct http_transaction *h, struct ctdlsession *c); int webserver(char *webserver_interface, int webserver_port, int webserver_protocol); void ctdl_printf(struct ctdlsession *ctdl, const char *format,...); int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len); -void do_502(struct http_transaction *h); -void do_404(struct http_transaction *h); -void do_412(struct http_transaction *h); void UrlizeText(StrBuf* Target, StrBuf *Source, StrBuf *WrkBuf); void json_render_one_message(struct http_transaction *h, struct ctdlsession *c, long msgnum);