Separate out the display name and email addresses in the JSON output of a message...
authorArt Cancro <ajc@citadel.org>
Fri, 9 Sep 2022 19:39:27 +0000 (15:39 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 9 Sep 2022 19:39:27 +0000 (15:39 -0400)
webcit-ng/server/forum_view.c
webcit-ng/static/css/webcit.css
webcit-ng/static/js/view_mail.js

index 90ef33746c68cfbc8a9d058fe6526fd5b18dae00..6d3feaffaa47bf858f0384b5d2139cf09685336f 100644 (file)
@@ -27,8 +27,6 @@ void json_render_one_message(struct http_transaction *h, struct ctdlsession *c,
        char content_transfer_encoding[1024] = { 0 };
        char content_type[1024] = { 0 };
        char datetime[128] = { 0 };
-       char author[1024] = { 0 };
-       char emailaddr[1024] = { 0 };
        int message_originated_locally = 0;
 
        setup_for_forum_view(c);
@@ -48,10 +46,10 @@ void json_render_one_message(struct http_transaction *h, struct ctdlsession *c,
 
                // citadel header parsing here
                if (!strncasecmp(buf, "from=", 5)) {
-                       safestrncpy(author, &buf[5], sizeof author);
+                       JsonObjectAppend(j, NewJsonPlainString(HKEY("from"), &buf[5], -1));
                }
                else if (!strncasecmp(buf, "rfca=", 5)) {
-                       safestrncpy(emailaddr, &buf[5], sizeof emailaddr);
+                       JsonObjectAppend(j, NewJsonPlainString(HKEY("rfca"), &buf[5], -1));
                }
                else if (!strncasecmp(buf, "time=", 5)) {
                        JsonObjectAppend(j, NewJsonNumber(HKEY("time"), atol(&buf[5])));
@@ -70,12 +68,7 @@ void json_render_one_message(struct http_transaction *h, struct ctdlsession *c,
                }
        }
 
-       if (message_originated_locally) {
-               JsonObjectAppend(j, NewJsonPlainString(HKEY("from"), author, -1));
-       }
-       else {
-               JsonObjectAppend(j, NewJsonPlainString(HKEY("from"), emailaddr, -1));           // FIXME do compound address string
-       }
+       JsonObjectAppend(j, NewJsonNumber(HKEY("locl"), message_originated_locally));
 
        if (!strcmp(buf, "text")) {
                while ((ctdl_readline(c, buf, sizeof(buf)) >= 0) && (strcmp(buf, "")) && (strcmp(buf, "000"))) {
index de5fbae2ff7a6bdfa5d2254052b7027eebcd6247..6d0f9d6156833af8390e7ccd26e087fc0f183828 100644 (file)
@@ -368,6 +368,20 @@ blockquote pre {
        cursor: default;
 }
 
+.ctdl-mail-subject {                                   /* Subject column in mailbox message list */
+}
+
+.ctdl-mail-sender {                                    /* Sender column in mailbox message list */
+}
+
+.ctdl-mail-date {                                      /* Date column in mailbox message list */
+       white-space: nowrap;
+}
+
+.ctdl-mail-msgnum {                                    /* # column in mailbox message list */
+       white-space: nowrap;
+}
+
 .ctdl-mailbox-reading-pane {                           /* message reading pane when in mailbox view */
        overflow-x: hidden;
        overflow-y: auto;
index 9ed218b04d44dda2fa6ddf3b30248d494c36af0f..5effc0b461bcc9180d5750c464a14c7789803f84 100644 (file)
@@ -13,6 +13,7 @@ var RefreshMailboxInterval;                                                   // We store our refresh timer here
 // Render a message into the mailbox view
 function mail_render_one(msg, target_div) {
        let div = "FIXME";
+       console.log(msg);
        try {
                outmsg =
                  "<div class=\"ctdl-mmsg-wrapper\">"                           // begin message wrapper
@@ -113,10 +114,10 @@ function mail_render_row(msg) {
                //+ "onmouseenter=\"console.log('mouse in');\" "
                //+ "onmouseleave=\"console.log('mouse out');\""
                + ">"
-               + "<td>" + msg["subject"] + "</td>"
-               + "<td>" + msg["author"] + " &lt;" + msg["addr"] + "&gt;</td>"
-               + "<td style=\"white-space: nowrap\">" + string_timestamp(msg["time"],1) + "</td>"
-               + "<td>" + msg["msgnum"] + "</td>"
+               + "<td class=\"ctdl-mail-subject\">" + msg["subject"] + "</td>"
+               + "<td class=\"ctdl-mail-sender\">" + msg["author"] + "</td>"
+               + "<td class=\"ctdl-mail-date\">" + string_timestamp(msg["time"],1) + "</td>"
+               + "<td class=\"ctdl-mail-msgnum\">" + msg["msgnum"] + "</td>"
                + "</tr>";
        return(row);
 }