/[LeafOK_CVS]/lbbs/src/section_list_display.c
ViewVC logotype

Diff of /lbbs/src/section_list_display.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.14 by sysadm, Sat May 31 12:46:08 2025 UTC Revision 1.17 by sysadm, Sat Jun 7 10:00:10 2025 UTC
# Line 21  Line 21 
21  #include "io.h"  #include "io.h"
22  #include "screen.h"  #include "screen.h"
23  #include "log.h"  #include "log.h"
24    #include "article_view_log.h"
25  #include "str_process.h"  #include "str_process.h"
26  #include <time.h>  #include <time.h>
27  #include <sys/param.h>  #include <sys/param.h>
# Line 49  static int section_list_draw_items(int p Line 50  static int section_list_draw_items(int p
50          int len;          int len;
51          int i;          int i;
52          char article_flag;          char article_flag;
53            int is_viewed;
54          time_t tm_now;          time_t tm_now;
55    
56          time(&tm_now);          time(&tm_now);
# Line 57  static int section_list_draw_items(int p Line 59  static int section_list_draw_items(int p
59    
60          for (i = 0; i < article_count; i++)          for (i = 0; i < article_count; i++)
61          {          {
62                  article_flag = ' ';                  is_viewed = article_view_log_is_viewed(p_articles[i]->aid, &BBS_article_view_log);
63                    if (is_viewed < 0)
64                    {
65                            log_error("article_view_log_is_viewed(aid=%d) error\n", p_articles[i]->aid);
66                            is_viewed = 0;
67                    }
68    
69                    article_flag = (is_viewed ? ' ' : 'N');
70    
71                  if (p_articles[i]->excerption)                  if (p_articles[i]->excerption)
72                  {                  {
73                          article_flag = 'm';                          article_flag = (is_viewed ? 'm' : 'M');
74                  }                  }
75                  else if (p_articles[i]->lock)                  else if (p_articles[i]->lock && is_viewed)
76                  {                  {
77                          article_flag = 'x';                          article_flag = 'x';
78                  }                  }
# Line 259  static int display_article_key_handler(i Line 268  static int display_article_key_handler(i
268                  if (section_topic_view_mode)                  if (section_topic_view_mode)
269                  {                  {
270                          snprintf(p_ctx->msg, sizeof(p_ctx->msg),                          snprintf(p_ctx->msg, sizeof(p_ctx->msg),
271                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] | "
272                                           "同主题阅读[\033[32m↑\033[33m/\033[32m↓\033[33m] │ "                                           "同主题阅读[\033[32m↑\033[33m/\033[32m↓\033[33m] | "
273                                           "模式[\033[32mp\033[33m] | 帮助[\033[32mh\033[33m] |");                                           "模式[\033[32mp\033[33m] | 帮助[\033[32mh\033[33m] |");
274                  }                  }
275                  else                  else
276                  {                  {
277                          snprintf(p_ctx->msg, sizeof(p_ctx->msg),                          snprintf(p_ctx->msg, sizeof(p_ctx->msg),
278                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] │ "                                           "| 返回[\033[32m←\033[33m,\033[32mESC\033[33m] | "
279                                           "移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] │ "                                           "移动[\033[32m↑\033[33m/\033[32m↓\033[33m/\033[32mPgUp\033[33m/\033[32mPgDn\033[33m] | "
280                                           "模式[\033[32mp\033[33m] | 帮助[\033[32mh\033[33m] |");                                           "模式[\033[32mp\033[33m] | 帮助[\033[32mh\033[33m] |");
281                  }                  }
282                  *p_key = 0;                  *p_key = 0;
283                  break;                  break;
284          case KEY_UP:          case KEY_UP:
285            case KEY_PGUP:
286            case KEY_HOME:
287                  if (p_ctx->reach_begin)                  if (p_ctx->reach_begin)
288                  {                  {
289                          if (section_topic_view_mode)                          if (section_topic_view_mode)
290                          {                          {
291                                  *p_key = KEY_PGUP;                                  *p_key = KEY_PGUP;
292                          }                          }
293                            else
294                            {
295                                    *p_key = KEY_UP;
296                            }
297                          return 1;                          return 1;
298                  }                  }
299                  break;                  break;
300          case KEY_DOWN:          case KEY_DOWN:
301            case KEY_PGDN:
302            case KEY_END:
303                  if (p_ctx->reach_end)                  if (p_ctx->reach_end)
304                  {                  {
305                          if (section_topic_view_mode)                          if (section_topic_view_mode)
306                          {                          {
307                                  *p_key = KEY_PGDN;                                  *p_key = KEY_PGDN;
308                          }                          }
309                            else
310                            {
311                                    *p_key = KEY_DOWN;
312                            }
313                          return 1;                          return 1;
314                  }                  }
315                  break;                  break;
# Line 414  int section_list_display(const char *sna Line 435  int section_list_display(const char *sna
435                                          break;                                          break;
436                                  }                                  }
437    
438                                    // Update article_view_log
439                                    if (article_view_log_set_viewed(p_articles[selected_index]->aid, &BBS_article_view_log) < 0)
440                                    {
441                                            log_error("article_view_log_set_viewed(aid=%d) error\n", p_articles[selected_index]->aid);
442                                    }
443    
444                                  switch (ret)                                  switch (ret)
445                                  {                                  {
446                                  case KEY_UP:                                  case KEY_UP:


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1