From b189e3c20289655e602210cb8e250bfd98d9dd47 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 8 Feb 2018 16:43:19 -0500 Subject: [PATCH] track c_lastseen so we can use it in read operations --- webcit-ng/room_functions.c | 3 ++- webcit-ng/static/js/main.js | 2 ++ webcit-ng/static/js/views.js | 2 +- webcit-ng/webcit.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/webcit-ng/room_functions.c b/webcit-ng/room_functions.c index f49485d47..21fe56460 100644 --- a/webcit-ng/room_functions.c +++ b/webcit-ng/room_functions.c @@ -424,6 +424,7 @@ void get_the_room_itself(struct http_transaction *h, struct ctdlsession *c) JsonObjectAppend(j, NewJsonNumber( HKEY("default_view"), c->room_default_view )); JsonObjectAppend(j, NewJsonNumber( HKEY("new_messages"), c->new_messages )); JsonObjectAppend(j, NewJsonNumber( HKEY("total_messages"), c->total_messages )); + JsonObjectAppend(j, NewJsonNumber( HKEY("last_seen"), c->last_seen )); StrBuf *sj = NewStrBuf(); SerializeJson(sj, j, 1); // '1' == free the source array @@ -553,7 +554,7 @@ void ctdl_r(struct http_transaction *h, struct ctdlsession *c) // 3 (int)info Info flag: set to nonzero if the user needs to read this room's info file // 4 (int)CCC->room.QRflags Various flags associated with this room. // 5 (long)CCC->room.QRhighest The highest message number present in this room - // 6 (long)vbuf.v_lastseen The highest message number the user has read in this room + 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. // 8 (int)raideflag Nonzero if user is either Aide or a Room Aide in this room // 9 (int)newmailcount The number of new Mail messages the user has diff --git a/webcit-ng/static/js/main.js b/webcit-ng/static/js/main.js index eeddc02b8..0170a987a 100644 --- a/webcit-ng/static/js/main.js +++ b/webcit-ng/static/js/main.js @@ -18,6 +18,7 @@ var current_view = 0; var logged_in = 0; var current_user = _("Not logged in."); var serv_info; +var last_seen = 0; var messages_per_page = 20; @@ -198,6 +199,7 @@ function gotoroom_2(data) { total_messages = data.total_messages; current_view = data.current_view; default_view = data.default_view; + last_seen = data.last_seen; update_banner(); render_room_view(); } diff --git a/webcit-ng/static/js/views.js b/webcit-ng/static/js/views.js index cf975ba04..ba1be9210 100644 --- a/webcit-ng/static/js/views.js +++ b/webcit-ng/static/js/views.js @@ -97,7 +97,7 @@ function forum_readmessages(flat_or_threads) { if ((this.status / 100) == 2) { - document.getElementById(innerdivname).innerHTML = "Are we logged in? " + logged_in + "