/[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.74 by sysadm, Mon Nov 10 14:24:37 2025 UTC Revision 1.81 by sysadm, Wed Dec 17 03:47:00 2025 UTC
# Line 6  Line 6 
6   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   */   */
8    
9    #ifdef HAVE_CONFIG_H
10    #include "config.h"
11    #endif
12    
13  #include "article_cache.h"  #include "article_cache.h"
14  #include "article_favor.h"  #include "article_favor.h"
15  #include "article_op.h"  #include "article_op.h"
# Line 67  enum select_cmd_t Line 71  enum select_cmd_t
71          SEARCH_USER,          SEARCH_USER,
72  };  };
73    
74  static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset)  static int section_list_draw_items(int page_id, const ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset)
75  {  {
76          char str_time[LINE_BUFFER_LEN];          char str_time[LINE_BUFFER_LEN];
77          struct tm tm_sub;          struct tm tm_sub;
# Line 266  static enum select_cmd_t section_list_se Line 270  static enum select_cmd_t section_list_se
270                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)
271                  {                  {
272                          BBS_last_access_tm = time(NULL);                          BBS_last_access_tm = time(NULL);
273    
274                            // Refresh current action
275                            if (user_online_update(NULL) < 0)
276                            {
277                                    log_error("user_online_update(NULL) error\n");
278                            }
279                  }                  }
280    
281                  switch (ch)                  switch (ch)
282                  {                  {
283                  case KEY_NULL: // broken pipe                  case KEY_NULL: // broken pipe
284    #ifdef _DEBUG
285                          log_error("KEY_NULL\n");                          log_error("KEY_NULL\n");
286    #endif
287                          return EXIT_SECTION;                          return EXIT_SECTION;
288                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
289                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
# Line 580  int section_list_display(const char *sna Line 592  int section_list_display(const char *sna
592          char stitle[BBS_section_title_max_len + 1];          char stitle[BBS_section_title_max_len + 1];
593          char master_list[(BBS_username_max_len + 1) * 3 + 1];          char master_list[(BBS_username_max_len + 1) * 3 + 1];
594          char page_info_str[LINE_BUFFER_LEN];          char page_info_str[LINE_BUFFER_LEN];
595          ARTICLE *p_articles[BBS_article_limit_per_page];          const ARTICLE *p_articles[BBS_article_limit_per_page];
596          int article_count;          int article_count;
597          int page_count;          int page_count;
598          int ontop_start_offset;          int ontop_start_offset;
# Line 708  int section_list_display(const char *sna Line 720  int section_list_display(const char *sna
720                  {                  {
721                  case EXIT_SECTION:                  case EXIT_SECTION:
722                          // Update current aid location                          // Update current aid location
723                          if (p_articles[selected_index] != NULL)                          if (selected_index < article_count && p_articles[selected_index] != NULL)
724                          {                          {
725                                  if (selected_index >= ontop_start_offset)                                  if (selected_index >= ontop_start_offset)
726                                  {                                  {
# Line 1187  int section_list_display(const char *sna Line 1199  int section_list_display(const char *sna
1199                          // Verify format                          // Verify format
1200                          for (i = 0, ok = 1; ok && username[i] != '\0'; i++)                          for (i = 0, ok = 1; ok && username[i] != '\0'; i++)
1201                          {                          {
1202                                  if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_'))))                                  if (!(isalpha((int)username[i]) || (i > 0 && (isdigit((int)username[i]) || username[i] == '_'))))
1203                                  {                                  {
1204                                          ok = 0;                                          ok = 0;
1205                                  }                                  }
# Line 1353  int section_list_ex_dir_display(SECTION_ Line 1365  int section_list_ex_dir_display(SECTION_
1365  {  {
1366          MENU_SET ex_menu_set;          MENU_SET ex_menu_set;
1367          int ch = 0;          int ch = 0;
1368            int loop;
1369    
1370          if (p_section == NULL)          if (p_section == NULL)
1371          {          {
# Line 1385  int section_list_ex_dir_display(SECTION_ Line 1398  int section_list_ex_dir_display(SECTION_
1398    
1399          if (display_menu(&ex_menu_set) == 0)          if (display_menu(&ex_menu_set) == 0)
1400          {          {
1401                  while (!SYS_server_exit)                  for (loop = 1; !SYS_server_exit && loop;)
1402                  {                  {
1403                          iflush();                          iflush();
1404                          ch = igetch(100);                          ch = igetch(100);
# Line 1393  int section_list_ex_dir_display(SECTION_ Line 1406  int section_list_ex_dir_display(SECTION_
1406                          if (ch != KEY_NULL && ch != KEY_TIMEOUT)                          if (ch != KEY_NULL && ch != KEY_TIMEOUT)
1407                          {                          {
1408                                  BBS_last_access_tm = time(NULL);                                  BBS_last_access_tm = time(NULL);
1409    
1410                                    // Refresh current action
1411                                    if (user_online_update(NULL) < 0)
1412                                    {
1413                                            log_error("user_online_update(NULL) error\n");
1414                                    }
1415                          }                          }
1416    
1417                          switch (ch)                          switch (ch)
1418                          {                          {
1419                          case KEY_NULL: // broken pipe                          case KEY_NULL: // broken pipe
1420    #ifdef _DEBUG
1421                                  log_error("KEY_NULL\n");                                  log_error("KEY_NULL\n");
1422                                  return 0;  #endif
1423                                    loop = 0;
1424                                    break;
1425                          case KEY_TIMEOUT:                          case KEY_TIMEOUT:
1426                                  if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)                                  if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
1427                                  {                                  {
1428                                          log_error("User input timeout\n");                                          log_error("User input timeout\n");
1429                                          return 0;                                          loop = 0;
1430                                            break;
1431                                  }                                  }
1432                                  continue;                                  continue;
1433                          case CR:                          case CR:
# Line 1412  int section_list_ex_dir_display(SECTION_ Line 1435  int section_list_ex_dir_display(SECTION_
1435                                  switch (menu_control(&ex_menu_set, ch))                                  switch (menu_control(&ex_menu_set, ch))
1436                                  {                                  {
1437                                  case EXITMENU:                                  case EXITMENU:
1438                                          ch = EXITMENU;                                          loop = 0;
1439                                          break;                                          break;
1440                                  case REDRAW:                                  case REDRAW:
1441                                          clearscr();                                          clearscr();
# Line 1425  int section_list_ex_dir_display(SECTION_ Line 1448  int section_list_ex_dir_display(SECTION_
1448                                          break;                                          break;
1449                                  }                                  }
1450                          }                          }
   
                         if (ch == EXITMENU)  
                         {  
                                 break;  
                         }  
1451                  }                  }
1452          }          }
1453    


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

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