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

Diff of /lbbs/src/article_favor_display.c

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

Revision 1.3 by sysadm, Fri Oct 17 01:25:08 2025 UTC Revision 1.4 by sysadm, Sat Oct 18 12:06:10 2025 UTC
# Line 71  static int article_favor_draw_items(int Line 71  static int article_favor_draw_items(int
71      int len;      int len;
72      int i;      int i;
73      char article_flag;      char article_flag;
74          int is_viewed;      int is_viewed;
75      time_t tm_now;      time_t tm_now;
76    
77      time(&tm_now);      time(&tm_now);
# Line 80  static int article_favor_draw_items(int Line 80  static int article_favor_draw_items(int
80    
81      for (i = 0; i < article_count; i++)      for (i = 0; i < article_count; i++)
82      {      {
83                  if (p_articles[i]->uid == BBS_priv.uid)          if (p_articles[i]->uid == BBS_priv.uid)
84                  {          {
85                          is_viewed = 1;              is_viewed = 1;
86                  }          }
87                  else          else
88                  {          {
89                          is_viewed = article_view_log_is_viewed(p_articles[i]->aid, &BBS_article_view_log);              is_viewed = article_view_log_is_viewed(p_articles[i]->aid, &BBS_article_view_log);
90                          if (is_viewed < 0)              if (is_viewed < 0)
91                          {              {
92                                  log_error("article_view_log_is_viewed(aid=%d) error\n", p_articles[i]->aid);                  log_error("article_view_log_is_viewed(aid=%d) error\n", p_articles[i]->aid);
93                                  is_viewed = 0;                  is_viewed = 0;
94                          }              }
95                  }          }
96    
97          if (p_articles[i]->excerption)          if (p_articles[i]->excerption)
98                  {          {
99                          article_flag = (is_viewed ? 'm' : 'M');              article_flag = (is_viewed ? 'm' : 'M');
100                  }          }
101                  else if (p_articles[i]->lock && is_viewed)          else if (p_articles[i]->lock && is_viewed)
102                  {          {
103                          article_flag = 'x';              article_flag = 'x';
104                  }          }
105                  else          else
106                  {          {
107                          article_flag = (is_viewed ? ' ' : 'N');              article_flag = (is_viewed ? ' ' : 'N');
108                  }          }
109    
110          localtime_r(&p_articles[i]->sub_dt, &tm_sub);          localtime_r(&p_articles[i]->sub_dt, &tm_sub);
111          if (tm_now - p_articles[i]->sub_dt < 3600 * 24 * 365)          if (tm_now - p_articles[i]->sub_dt < 3600 * 24 * 365)
# Line 120  static int article_favor_draw_items(int Line 120  static int article_favor_draw_items(int
120          strncpy(title_f, (p_articles[i]->tid == 0 ? "● " : ""), sizeof(title_f) - 1);          strncpy(title_f, (p_articles[i]->tid == 0 ? "● " : ""), sizeof(title_f) - 1);
121          title_f[sizeof(title_f) - 1] = '\0';          title_f[sizeof(title_f) - 1] = '\0';
122          strncat(title_f, (p_articles[i]->transship ? "[转载]" : ""), sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));          strncat(title_f, (p_articles[i]->transship ? "[转载]" : ""), sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
123                  strncat(title_f, p_articles[i]->title, sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));          strncat(title_f, p_articles[i]->title, sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
124    
125          len = split_line(title_f, 59 - (display_sname ? BBS_section_name_max_len : BBS_username_max_len), &eol, &title_f_len, 1);          len = split_line(title_f, 59 - (display_sname ? BBS_section_name_max_len : BBS_username_max_len), &eol, &title_f_len, 1);
126          if (title_f[len] != '\0')          if (title_f[len] != '\0')
# Line 169  static enum select_cmd_t article_favor_s Line 169  static enum select_cmd_t article_favor_s
169    
170          switch (ch)          switch (ch)
171          {          {
172            case KEY_NULL: // broken pipe
173                log_error("KEY_NULL\n");
174          case KEY_ESC:          case KEY_ESC:
175          case KEY_LEFT:          case KEY_LEFT:
         case KEY_NULL:        // broken pipe  
                         log_error("KEY_NULL\n");  
176              return EXIT_LIST; // exit list              return EXIT_LIST; // exit list
177          case KEY_TIMEOUT:          case KEY_TIMEOUT:
178              if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)              if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
179              {              {
180                                  log_error("User input timeout\n");                  log_error("User input timeout\n");
181                  return EXIT_LIST; // exit list                  return EXIT_LIST; // exit list
182              }              }
183              continue;              continue;
# Line 262  static enum select_cmd_t article_favor_s Line 262  static enum select_cmd_t article_favor_s
262          case 'h':          case 'h':
263              return SHOW_HELP;              return SHOW_HELP;
264          default:          default:
265                break;
266          }          }
267    
268          if (old_page_id != *p_page_id)          if (old_page_id != *p_page_id)


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

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