Don't re-display a selected message when refreshing the mailbox:
authorArt Cancro <ajc@citadel.org>
Mon, 4 Jul 2022 15:23:20 +0000 (11:23 -0400)
committerArt Cancro <ajc@citadel.org>
Mon, 4 Jul 2022 15:23:20 +0000 (11:23 -0400)
webcit-ng/http.c
webcit-ng/static/js/view_mail.js
webcit-ng/webserver.c

index 40024b3b2d4a7a5ef2f150d4f7f23f59f6d3ae7f..55c335eff5100ca1532e880a207367c6c358dfc0 100644 (file)
@@ -131,7 +131,7 @@ void perform_one_http_transaction(struct client_handle *ch) {
                                h.url = strdup(d);
                        }
                }
-               else {                  // Subsequent lines are headers.
+               else {                          // Subsequent lines are headers.
                        c = strchr(buf, ':');   // Header line folding is obsolete so we don't support it.
                        if (c != NULL) {
 
@@ -192,9 +192,9 @@ void perform_one_http_transaction(struct client_handle *ch) {
                syslog(LOG_DEBUG, "Client disconnected");
        }
        else {
-#ifdef DEBUG_HTTP
+//#ifdef DEBUG_HTTP
                syslog(LOG_DEBUG, "\033[33m\033[1m< %s %s\033[0m", h.method, h.url);
-#endif
+//#endif
 
                // If there is a request body, read it now.
                char *ccl = header_val(&h, "Content-Length");
index 01c184970209efd9af86aba344324f40fef75b3f..9642886405bba271402817c76cf2fda548e02693 100644 (file)
@@ -100,12 +100,14 @@ function select_message(msgnum) {
        }
 
        // highlight the newly selected message
-       selected_message = msgnum;
-       document.getElementById("ctdl-msgsum-" + selected_message).classList.add("w3-blue");
-       document.getElementById("ctdl-msgsum-" + selected_message).scrollIntoView();
+       document.getElementById("ctdl-msgsum-" + msgnum).classList.add("w3-blue");
+       document.getElementById("ctdl-msgsum-" + msgnum).scrollIntoView();
 
-       // display the message
-       mail_display_message(msgnum, document.getElementById("ctdl-reading-pane"));
+       // display the message if it isn't already displayed
+       if (selected_message != msgnum) {
+               selected_message = msgnum;
+               mail_display_message(msgnum, document.getElementById("ctdl-reading-pane"));
+       }
 }
 
 
index 07109b01d311ad2d3930b7a90b1962d631c89bd3..2e22efabd669b5f34835fff04c772d271094c61f 100644 (file)
@@ -1,4 +1,3 @@
-//
 // webserver.c
 //
 // This module handles the task of setting up a listening socket, accepting