From 61b00f502908ff4a4f481aca8264999158b7984b Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 23 Nov 2022 16:51:06 -0500 Subject: [PATCH] MAKE WAY FOR BIFF in webcit-ng --- webcit-ng/server/room_functions.c | 3 +-- webcit-ng/server/webcit.h | 1 - webcit-ng/static/js/main.js | 1 - webcit-ng/static/js/view_mail.js | 15 +++++++++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/webcit-ng/server/room_functions.c b/webcit-ng/server/room_functions.c index e18633a8b..f6c843b7e 100644 --- a/webcit-ng/server/room_functions.c +++ b/webcit-ng/server/room_functions.c @@ -508,7 +508,6 @@ void get_the_room_itself(struct http_transaction *h, struct ctdlsession *c) { JsonObjectAppend(j, NewJsonNumber(HKEY("total_messages"), c->total_messages)); JsonObjectAppend(j, NewJsonNumber(HKEY("last_seen"), c->last_seen)); JsonObjectAppend(j, NewJsonNumber(HKEY("room_mtime"), c->room_mtime)); - JsonObjectAppend(j, NewJsonNumber(HKEY("new_mail"), c->new_mail)); StrBuf *sj = NewStrBuf(); SerializeJson(sj, j, 1); // '1' == free the source array @@ -632,7 +631,7 @@ void ctdl_r(struct http_transaction *h, struct ctdlsession *c) { c->last_seen = extract_long(&buf[4], 6); // The highest message number the user has read in this room // 7 (int)rmailflag Boolean flag: 1 if this is a Mail> room, 0 otherwise. c->is_room_aide = extract_int(&buf[4], 8); - c->new_mail = extract_int(&buf[4], 9); // the number of new messages in the user's INBOX + // 9 This position is no longer used // 10 (int)CC->room.QRfloor The floor number this room resides on c->room_current_view = extract_int(&buf[4], 11); c->room_default_view = extract_int(&buf[4], 12); diff --git a/webcit-ng/server/webcit.h b/webcit-ng/server/webcit.h index 9e6d069ba..d8321b49f 100644 --- a/webcit-ng/server/webcit.h +++ b/webcit-ng/server/webcit.h @@ -91,7 +91,6 @@ struct ctdlsession { time_t last_access; // Timestamp of last request that used this session time_t num_requests_handled; time_t room_mtime; // Timestampt of the most recent write activity in this room - int new_mail; // number of new messages in the user's INBOX }; extern char *ssl_cipher_list; diff --git a/webcit-ng/static/js/main.js b/webcit-ng/static/js/main.js index fd0b40767..0ebb577a0 100644 --- a/webcit-ng/static/js/main.js +++ b/webcit-ng/static/js/main.js @@ -77,7 +77,6 @@ function gotoroom(roomname) { is_room_aide = data.is_room_aide; room_mtime = data.room_mtime; can_delete_messages = data.can_delete_messages; - console.log("new mail: " + data.new_mail); update_banner(); render_room_view(); } diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 503eedfc6..eeda88fc3 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -231,11 +231,9 @@ function refresh_mail_display() { // This is where the rendering of the message list in the mailbox view is performed. -// Set notify to newmail_notify.NO or newmail_notify.YES depending on whether we want notifications for new mail. +// Set notify to newmail_notify.NO or newmail_notify.YES depending on whether we are interested in the arrival of new messages. function render_mailbox_display(notify) { - let do_notify = 0; - url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/mailbox"; fetch_mailbox = async() => { response = await fetch(url); @@ -254,7 +252,6 @@ function render_mailbox_display(notify) { let m = parseInt(msgs[i].msgnum); if (m > highest_mailnum) { highest_mailnum = m; - do_notify += 1; } } @@ -264,10 +261,20 @@ function render_mailbox_display(notify) { if (selected_message > 0) { // if we had a message selected, keep it selected select_message(selected_message); } + + + + +/* if ( (do_notify > 0) && (notify == newmail_notify.YES) ) { console.log(do_notify + " new mail"); new_mail_sound.play(); // FIXME do a visual notification as well + // FIXME move this to BIFF } + */ + + + } } fetch_mailbox(); -- 2.39.2