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

Diff of /lbbs/src/user_list_display.c

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

Revision 1.21 by sysadm, Tue Nov 4 14:58:56 2025 UTC Revision 1.26 by sysadm, Wed Dec 17 03:47:01 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 "common.h"  #include "common.h"
14  #include "io.h"  #include "io.h"
15  #include "log.h"  #include "log.h"
# Line 214  static enum select_cmd_t user_list_selec Line 218  static enum select_cmd_t user_list_selec
218                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)
219                  {                  {
220                          BBS_last_access_tm = time(NULL);                          BBS_last_access_tm = time(NULL);
221    
222                            // Refresh current action
223                            if (user_online_update(NULL) < 0)
224                            {
225                                    log_error("user_online_update(NULL) error\n");
226                            }
227                  }                  }
228    
229                  switch (ch)                  switch (ch)
230                  {                  {
231                  case KEY_NULL: // broken pipe                  case KEY_NULL: // broken pipe
232    #ifdef _DEBUG
233                          log_error("KEY_NULL\n");                          log_error("KEY_NULL\n");
234    #endif
235                  case KEY_ESC:                  case KEY_ESC:
236                  case KEY_LEFT:                  case KEY_LEFT:
237                          return EXIT_LIST; // exit list                          return EXIT_LIST; // exit list
238                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
239                          if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
240                          {                          {
241                                  log_error("User input timeout\n");                                  log_error("User input timeout\n");
242                                  return EXIT_LIST; // exit list                                  return EXIT_LIST; // exit list
# Line 496  int user_list_search(void) Line 508  int user_list_search(void)
508                  // Verify format                  // Verify format
509                  for (i = 0, ok = 1; ok && username[i] != '\0'; i++)                  for (i = 0, ok = 1; ok && username[i] != '\0'; i++)
510                  {                  {
511                          if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_'))))                          if (!(isalpha((int)username[i]) || (i > 0 && (isdigit((int)username[i]) || username[i] == '_'))))
512                          {                          {
513                                  ok = 0;                                  ok = 0;
514                          }                          }
# Line 539  int user_list_search(void) Line 551  int user_list_search(void)
551                          prints("存在多个匹配的用户,按\033[1;33mEnter\033[m精确查找");                          prints("存在多个匹配的用户,按\033[1;33mEnter\033[m精确查找");
552                          iflush();                          iflush();
553    
554                          ch = igetch_t(MAX_DELAY_TIME);                          ch = igetch_t(BBS_max_user_idle_time);
555                          switch (ch)                          switch (ch)
556                          {                          {
557                          case KEY_NULL:                          case KEY_NULL:
# Line 552  int user_list_search(void) Line 564  int user_list_search(void)
564                                  break;                                  break;
565                          default:                          default:
566                                  i = (int)strnlen(username, sizeof(username) - 1);                                  i = (int)strnlen(username, sizeof(username) - 1);
567                                  if (i + 1 <= BBS_username_max_len && (isalnum((char)ch) || ch == '_'))                                  if (i + 1 <= BBS_username_max_len && (isalnum(ch) || ch == '_'))
568                                  {                                  {
569                                          username[i] = (char)ch;                                          username[i] = (char)ch;
570                                          username[i + 1] = '\0';                                          username[i + 1] = '\0';


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

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