Skip/Goto are functionally complete.
authorArt Cancro <ajc@citadel.org>
Sun, 13 Feb 2022 21:53:26 +0000 (16:53 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 13 Feb 2022 21:53:26 +0000 (16:53 -0500)
webcit-ng/request.c
webcit-ng/room_functions.c
webcit-ng/static/index.html
webcit-ng/static/js/main.js
webcit-ng/webcit.h

index f11865bbd3e9209b7f449ded9ce5405fa2f65454..20216a0efd55549d84e941b97cbb857087d6c6b9 100644 (file)
@@ -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;
index c0c67569fd0974fbc9832e6efaf79b0338a8fad0..0a8b73c416a131d488d678dbd236bf846c0bb702 100644 (file)
@@ -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);
+       }
 }
 
 
index 2db6bf63ae145ba0caeb7faffd4f3dcff6b9cc9b..ddada356400ffb470942b7346d36102813219cc5 100644 (file)
@@ -32,7 +32,7 @@ LOADING
        </span>
        <span class="w3-right">
                <button id="ctdl-newmsg-button" style="display:none" class="w3-bar-item w3-button" onclick="entmsg_dispatcher();">enter</button>
-               <button id="ctdl-skip-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(0);">ungoto</button>
+               <button id="ctdl-ungoto-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(0);">ungoto</button>
                <button id="ctdl-skip-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(1);">skip</button>
                <button id="ctdl-goto-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(2);">goto</button>
                <span id="lilo" class="w3-bar-item">Login</span>
index ba8dfb0252f74a8f0a0108f021e58f117bbf03f6..cc4627b713c6cfaea6985206c6144d84379679fa 100644 (file)
@@ -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);
                }
        }
index c98be4b71eeb2ccb763d682e2a6179818913f8e3..17ffd0f23972c988b19dd1c2b69ec725996c2f49 100644 (file)
@@ -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);