/[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.19 by sysadm, Mon Nov 3 11:49:12 2025 UTC Revision 1.24 by sysadm, Mon Nov 17 12:16:48 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /* SPDX-License-Identifier: GPL-3.0-or-later */
2                                           user_list_display.c  -  description  /*
3                                                           -------------------   * user_list_display
4          Copyright            : (C) 2004-2025 by Leaflet   *   - user interactive list of (online) users
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 "common.h"  #include "common.h"
14  #include "io.h"  #include "io.h"
# Line 232  static enum select_cmd_t user_list_selec Line 228  static enum select_cmd_t user_list_selec
228                  case KEY_LEFT:                  case KEY_LEFT:
229                          return EXIT_LIST; // exit list                          return EXIT_LIST; // exit list
230                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
231                          if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
232                          {                          {
233                                  log_error("User input timeout\n");                                  log_error("User input timeout\n");
234                                  return EXIT_LIST; // exit list                                  return EXIT_LIST; // exit list
# Line 504  int user_list_search(void) Line 500  int user_list_search(void)
500                  // Verify format                  // Verify format
501                  for (i = 0, ok = 1; ok && username[i] != '\0'; i++)                  for (i = 0, ok = 1; ok && username[i] != '\0'; i++)
502                  {                  {
503                          if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_'))))                          if (!(isalpha((int)username[i]) || (i > 0 && (isdigit((int)username[i]) || username[i] == '_'))))
504                          {                          {
505                                  ok = 0;                                  ok = 0;
506                          }                          }
# Line 547  int user_list_search(void) Line 543  int user_list_search(void)
543                          prints("存在多个匹配的用户,按\033[1;33mEnter\033[m精确查找");                          prints("存在多个匹配的用户,按\033[1;33mEnter\033[m精确查找");
544                          iflush();                          iflush();
545    
546                          ch = igetch_t(MAX_DELAY_TIME);                          ch = igetch_t(BBS_max_user_idle_time);
547                          switch (ch)                          switch (ch)
548                          {                          {
549                          case KEY_NULL:                          case KEY_NULL:
# Line 560  int user_list_search(void) Line 556  int user_list_search(void)
556                                  break;                                  break;
557                          default:                          default:
558                                  i = (int)strnlen(username, sizeof(username) - 1);                                  i = (int)strnlen(username, sizeof(username) - 1);
559                                  if (i + 1 <= BBS_username_max_len && (isalnum((char)ch) || ch == '_'))                                  if (i + 1 <= BBS_username_max_len && (isalnum(ch) || ch == '_'))
560                                  {                                  {
561                                          username[i] = (char)ch;                                          username[i] = (char)ch;
562                                          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