| 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" |
| 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 |
| 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 |
} |
} |
| 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: |
| 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'; |