From 23ea433f8dc3090ce8860da35fb6fa470d0ae1bd Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 6 Feb 2010 21:31:49 +0000 Subject: [PATCH] * If we perform a 'read new' operation in a room with no new messages, display the final page and scroll to the bottom. --- webcit/bbsview_renderer.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/webcit/bbsview_renderer.c b/webcit/bbsview_renderer.c index 4fbaac6aa..eefa1fbf0 100644 --- a/webcit/bbsview_renderer.c +++ b/webcit/bbsview_renderer.c @@ -192,6 +192,18 @@ int bbsview_RenderView_or_Tail(SharedMessageStatus *Stat, } } + /* Still set to -3 ? If so, that probably means that there are no new messages, + * so we'll go to the *end* of the final page. + */ + if (BBS->requested_page == (-3)) { + if (BBS->num_msgs == 0) { + BBS->requested_page = 0; + } + else { + BBS->requested_page = (BBS->num_msgs / Stat->maxmsgs); + } + } + start_index = BBS->requested_page * Stat->maxmsgs; if (start_index < 0) start_index = 0; end_index = start_index + Stat->maxmsgs - 1; @@ -203,8 +215,14 @@ int bbsview_RenderView_or_Tail(SharedMessageStatus *Stat, for (i=start_index; (i<=end_index && inum_msgs); ++i) { if ( - (BBS->msgs[i] > BBS->lastseen) - && ( (i == 0) || (BBS->msgs[i-1] <= BBS->lastseen) ) + ( + (BBS->msgs[i] > BBS->lastseen) + && ( (i == 0) || (BBS->msgs[i-1] <= BBS->lastseen) ) + ) + || ( + (i == (BBS->num_msgs - 1)) + && (BBS->msgs[i] <= BBS->lastseen) + ) ) { /* new messages start here */ wc_printf(""); -- 2.39.2