From: Art Cancro Date: Fri, 9 Sep 2022 19:39:27 +0000 (-0400) Subject: Separate out the display name and email addresses in the JSON output of a message... X-Git-Tag: v958~20 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=42f5362eb75d22bbfba626bc5df452ffe180bb00;p=citadel.git Separate out the display name and email addresses in the JSON output of a message. Also send out the "message originated locally" flag. This will allow the JS side to be smarter about how it displays. --- diff --git a/webcit-ng/server/forum_view.c b/webcit-ng/server/forum_view.c index 90ef33746..6d3feaffa 100644 --- a/webcit-ng/server/forum_view.c +++ b/webcit-ng/server/forum_view.c @@ -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"))) { diff --git a/webcit-ng/static/css/webcit.css b/webcit-ng/static/css/webcit.css index de5fbae2f..6d0f9d615 100644 --- a/webcit-ng/static/css/webcit.css +++ b/webcit-ng/static/css/webcit.css @@ -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; diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 9ed218b04..5effc0b46 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -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 = "
" // begin message wrapper @@ -113,10 +114,10 @@ function mail_render_row(msg) { //+ "onmouseenter=\"console.log('mouse in');\" " //+ "onmouseleave=\"console.log('mouse out');\"" + ">" - + "" + msg["subject"] + "" - + "" + msg["author"] + " <" + msg["addr"] + ">" - + "" + string_timestamp(msg["time"],1) + "" - + "" + msg["msgnum"] + "" + + "" + msg["subject"] + "" + + "" + msg["author"] + "" + + "" + string_timestamp(msg["time"],1) + "" + + "" + msg["msgnum"] + "" + ""; return(row); }