/[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.41 by sysadm, Tue Sep 30 04:56:16 2025 UTC Revision 1.44 by sysadm, Wed Oct 1 08:58:25 2025 UTC
# Line 61  static int section_list_draw_items(int p Line 61  static int section_list_draw_items(int p
61          int eol;          int eol;
62          int len;          int len;
63          int i;          int i;
64            size_t j;
65          char article_flag;          char article_flag;
66          int is_viewed;          int is_viewed;
67          time_t tm_now;          time_t tm_now;
# Line 111  static int section_list_draw_items(int p Line 112  static int section_list_draw_items(int p
112                  strncpy(title_f, (p_articles[i]->tid == 0 ? "● " : ""), sizeof(title_f) - 1);                  strncpy(title_f, (p_articles[i]->tid == 0 ? "● " : ""), sizeof(title_f) - 1);
113                  title_f[sizeof(title_f) - 1] = '\0';                  title_f[sizeof(title_f) - 1] = '\0';
114                  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)));
115                  strncat(title_f, p_articles[i]->title, sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));  
116                    // Rewrite title with "Re: Re: " prefix into "Re: ... "
117                    j = 0;
118                    if (p_articles[i]->tid != 0)
119                    {
120                            while (strncmp(p_articles[i]->title + j, "Re: ", strlen("Re: ")) == 0)
121                            {
122                                    j += strlen("Re: ");
123                            }
124                            if (j >= strlen("Re: Re: "))
125                            {
126                                    strncat(title_f, "Re: ... ", sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
127                            }
128                            else
129                            {
130                                    j = 0;
131                            }
132                    }
133                    strncat(title_f, p_articles[i]->title + j, sizeof(title_f) - 1 - strnlen(title_f, sizeof(title_f)));
134    
135                  len = split_line(title_f, 47 - (display_nickname ? 8 : 0), &eol, &title_f_len, 1);                  len = split_line(title_f, 47 - (display_nickname ? 8 : 0), &eol, &title_f_len, 1);
136                  if (title_f[len] != '\0')                  if (title_f[len] != '\0')
137                  {                  {
# Line 124  static int section_list_draw_items(int p Line 144  static int section_list_draw_items(int p
144                          prints("   \033[1;33m[提示]\033[m %c %s%*s %s %s%s\033[m",                          prints("   \033[1;33m[提示]\033[m %c %s%*s %s %s%s\033[m",
145                                     article_flag,                                     article_flag,
146                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),
147                                     (display_nickname ? BBS_nickname_max_len - (int)strnlen(p_articles[i]->nickname, sizeof(p_articles[i]->nickname))                                     (display_nickname ? BBS_nickname_max_len / 2 - str_length(p_articles[i]->nickname, 1)
148                                                                           : BBS_username_max_len - (int)strnlen(p_articles[i]->username, sizeof(p_articles[i]->username))),                                                                           : BBS_username_max_len - str_length(p_articles[i]->username, 1)),
149                                     "",                                     "",
150                                     str_time,                                     str_time,
151                                     (p_articles[i]->aid == section_topic_view_tid                                     (p_articles[i]->aid == section_topic_view_tid
# Line 146  static int section_list_draw_items(int p Line 166  static int section_list_draw_items(int p
166                                     p_articles[i]->aid,                                     p_articles[i]->aid,
167                                     article_flag,                                     article_flag,
168                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),                                     (display_nickname ? p_articles[i]->nickname : p_articles[i]->username),
169                                     (display_nickname ? BBS_nickname_max_len - (int)strnlen(p_articles[i]->nickname, sizeof(p_articles[i]->nickname))                                     (display_nickname ? BBS_nickname_max_len / 2 - str_length(p_articles[i]->nickname, 1)
170                                                                           : BBS_username_max_len - (int)strnlen(p_articles[i]->username, sizeof(p_articles[i]->username))),                                                                           : BBS_username_max_len - str_length(p_articles[i]->username, 1)),
171                                     "",                                     "",
172                                     str_time,                                     str_time,
173                                     (p_articles[i]->aid == section_topic_view_tid                                     (p_articles[i]->aid == section_topic_view_tid
# Line 271  static enum select_cmd_t section_list_se Line 291  static enum select_cmd_t section_list_se
291                                          (*p_page_id)--;                                          (*p_page_id)--;
292                                          *p_selected_index = BBS_article_limit_per_page - 1;                                          *p_selected_index = BBS_article_limit_per_page - 1;
293                                  }                                  }
294                                    else if (ch == KEY_UP || ch == 'k') // Rotate to the tail of section list
295                                    {
296                                            if (total_page > 0)
297                                            {
298                                                    *p_page_id = total_page - 1;
299                                            }
300                                            if (item_count > 0)
301                                            {
302                                                    *p_selected_index = item_count - 1;
303                                            }
304                                    }
305                          }                          }
306                          else                          else
307                          {                          {
# Line 298  static enum select_cmd_t section_list_se Line 329  static enum select_cmd_t section_list_se
329                                          (*p_page_id)++;                                          (*p_page_id)++;
330                                          *p_selected_index = 0;                                          *p_selected_index = 0;
331                                  }                                  }
332                                  else // end of last page                                  else if (ch == KEY_DOWN || ch == 'j') // Rotate to the head of section list
333                                  {                                  {
334                                          return CHANGE_PAGE; // force refresh pages                                          *p_page_id = 0;
335                                            *p_selected_index = 0;
336                                  }                                  }
337                          }                          }
338                          else                          else


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

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