/[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.68 by sysadm, Tue Nov 4 06:36:52 2025 UTC Revision 1.78 by sysadm, Sun Nov 23 04:28:24 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                          section_list_display.c  -  description  /*
3                                                           -------------------   * section_list_display
4          Copyright            : (C) 2004-2025 by Leaflet   *   - user interactive feature of section articles list
5          Email                : leaflet@leafok.com   *
6   ***************************************************************************/   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7     */
8  /***************************************************************************  
9   *                                                                         *  #ifdef HAVE_CONFIG_H
10   *   This program is free software; you can redistribute it and/or modify  *  #include "config.h"
11   *   it under the terms of the GNU General Public License as published by  *  #endif
  *   the Free Software Foundation; either version 3 of the License, or     *  
  *   (at your option) any later version.                                   *  
  *                                                                         *  
  ***************************************************************************/  
12    
13  #include "article_cache.h"  #include "article_cache.h"
14  #include "article_favor.h"  #include "article_favor.h"
# Line 39  Line 35 
35  #include <time.h>  #include <time.h>
36  #include <sys/param.h>  #include <sys/param.h>
37    
38  #define TITLE_SEARCH_MAX_LEN 60  enum _section_list_display_constant_t
39    {
40            TITLE_SEARCH_MAX_LEN = 60,
41    };
42    
43  static int32_t section_aid_locations[BBS_max_section] = {0};  static int32_t section_aid_locations[BBS_max_section] = {0};
44  static int section_topic_view_mode = 0;  static int section_topic_view_mode = 0;
# Line 226  static int section_list_draw_screen(cons Line 225  static int section_list_draw_screen(cons
225    
226          if (master_list[0] != '\0')          if (master_list[0] != '\0')
227          {          {
228                  snprintf(str_section_master, sizeof(str_section_master), "版主:%s", master_list);                  snprintf(str_section_master, sizeof(str_section_master), "版主: %s", master_list);
229          }          }
230          snprintf(str_section_name, sizeof(str_section_name), "讨论区 [%s]", sname);          snprintf(str_section_name, sizeof(str_section_name), "讨论区 [%s]", sname);
231    
# Line 279  static enum select_cmd_t section_list_se Line 278  static enum select_cmd_t section_list_se
278                          log_error("KEY_NULL\n");                          log_error("KEY_NULL\n");
279                          return EXIT_SECTION;                          return EXIT_SECTION;
280                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
281                          if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
282                          {                          {
283                                  log_error("User input timeout\n");                                  log_error("User input timeout\n");
284                                  return EXIT_SECTION;                                  return EXIT_SECTION;
# Line 713  int section_list_display(const char *sna Line 712  int section_list_display(const char *sna
712                  {                  {
713                  case EXIT_SECTION:                  case EXIT_SECTION:
714                          // Update current aid location                          // Update current aid location
715                          if (p_articles[selected_index] != NULL)                          if (selected_index < article_count && p_articles[selected_index] != NULL)
716                          {                          {
717                                  if (selected_index >= ontop_start_offset)                                  if (selected_index >= ontop_start_offset)
718                                  {                                  {
# Line 1181  int section_list_display(const char *sna Line 1180  int section_list_display(const char *sna
1180                          moveto(SCREEN_ROWS, 1);                          moveto(SCREEN_ROWS, 1);
1181                          clrtoeol();                          clrtoeol();
1182                          get_data(SCREEN_ROWS, 1,                          get_data(SCREEN_ROWS, 1,
1183                                           (direction == 1 ? "向下搜寻作者: " : "向上搜寻作者: "),                                           (direction == 1 ? "↓搜寻作者: " : "↑搜寻作者: "),
1184                                           username, sizeof(username), BBS_username_max_len);                                           username, sizeof(username), BBS_username_max_len);
1185    
1186                          if (username[0] == '\0')                          if (username[0] == '\0')
# Line 1192  int section_list_display(const char *sna Line 1191  int section_list_display(const char *sna
1191                          // Verify format                          // Verify format
1192                          for (i = 0, ok = 1; ok && username[i] != '\0'; i++)                          for (i = 0, ok = 1; ok && username[i] != '\0'; i++)
1193                          {                          {
1194                                  if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_'))))                                  if (!(isalpha((int)username[i]) || (i > 0 && (isdigit((int)username[i]) || username[i] == '_'))))
1195                                  {                                  {
1196                                          ok = 0;                                          ok = 0;
1197                                  }                                  }
# Line 1270  int section_list_display(const char *sna Line 1269  int section_list_display(const char *sna
1269                          moveto(SCREEN_ROWS, 1);                          moveto(SCREEN_ROWS, 1);
1270                          clrtoeol();                          clrtoeol();
1271                          get_data(SCREEN_ROWS, 1,                          get_data(SCREEN_ROWS, 1,
1272                                           (direction == 1 ? "向下搜寻标题: " : "向上搜寻标题: "),                                           (direction == 1 ? "↓搜寻标题: " : "↑搜寻标题: "),
1273                                           title, sizeof(title), TITLE_SEARCH_MAX_LEN);                                           title, sizeof(title), TITLE_SEARCH_MAX_LEN);
1274    
1275                          if (title[0] == '\0')                          if (title[0] == '\0')
# Line 1358  int section_list_ex_dir_display(SECTION_ Line 1357  int section_list_ex_dir_display(SECTION_
1357  {  {
1358          MENU_SET ex_menu_set;          MENU_SET ex_menu_set;
1359          int ch = 0;          int ch = 0;
1360            int loop;
1361    
1362          if (p_section == NULL)          if (p_section == NULL)
1363          {          {
# Line 1390  int section_list_ex_dir_display(SECTION_ Line 1390  int section_list_ex_dir_display(SECTION_
1390    
1391          if (display_menu(&ex_menu_set) == 0)          if (display_menu(&ex_menu_set) == 0)
1392          {          {
1393                  while (!SYS_server_exit)                  for (loop = 1; !SYS_server_exit && loop;)
1394                  {                  {
1395                          iflush();                          iflush();
1396                          ch = igetch(100);                          ch = igetch(100);
# Line 1404  int section_list_ex_dir_display(SECTION_ Line 1404  int section_list_ex_dir_display(SECTION_
1404                          {                          {
1405                          case KEY_NULL: // broken pipe                          case KEY_NULL: // broken pipe
1406                                  log_error("KEY_NULL\n");                                  log_error("KEY_NULL\n");
1407                                  return 0;                                  loop = 0;
1408                                    break;
1409                          case KEY_TIMEOUT:                          case KEY_TIMEOUT:
1410                                  if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                                  if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
1411                                  {                                  {
1412                                          log_error("User input timeout\n");                                          log_error("User input timeout\n");
1413                                          return 0;                                          loop = 0;
1414                                            break;
1415                                  }                                  }
1416                                  continue;                                  continue;
1417                          case CR:                          case CR:
# Line 1417  int section_list_ex_dir_display(SECTION_ Line 1419  int section_list_ex_dir_display(SECTION_
1419                                  switch (menu_control(&ex_menu_set, ch))                                  switch (menu_control(&ex_menu_set, ch))
1420                                  {                                  {
1421                                  case EXITMENU:                                  case EXITMENU:
1422                                          ch = EXITMENU;                                          loop = 0;
1423                                          break;                                          break;
1424                                  case REDRAW:                                  case REDRAW:
1425                                          clearscr();                                          clearscr();
# Line 1430  int section_list_ex_dir_display(SECTION_ Line 1432  int section_list_ex_dir_display(SECTION_
1432                                          break;                                          break;
1433                                  }                                  }
1434                          }                          }
   
                         if (ch == EXITMENU)  
                         {  
                                 break;  
                         }  
1435                  }                  }
1436          }          }
1437    


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

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