--- lbbs/src/user_info_display.c 2025/10/25 13:09:42 1.14 +++ lbbs/src/user_info_display.c 2025/11/05 04:19:21 1.21 @@ -1,18 +1,10 @@ -/*************************************************************************** - user_list_display.c - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * user_list_display + * - display user information + * + * Copyright (C) 2004-2025 Leaflet + */ #include "bbs.h" #include "ip_mask.h" @@ -28,8 +20,11 @@ #include #include -#define BBS_max_sessions_per_user 10 -#define LAST_LOGIN_DT_MAX_LEN 50 +enum _user_info_display_constant_t +{ + BBS_max_sessions_per_user = 10, + LAST_LOGIN_DT_MAX_LEN = 50, +}; static int display_user_info_key_handler(int *p_key, DISPLAY_CTX *p_ctx) { @@ -54,7 +49,7 @@ int user_info_display(USER_INFO *p_user_ int life; int user_level; const char *user_level_name; - char intro_f[BBS_user_intro_max_len]; + char intro_f[BBS_user_intro_max_len + 1]; int intro_len; char user_info_f[BUFSIZ]; long line_offsets[BBS_user_intro_max_line + 1]; @@ -163,7 +158,7 @@ int user_info_display(USER_INFO *p_user_ user_level = get_user_level(p_user_info->exp); user_level_name = get_user_level_name(user_level); - intro_len = lml_render(p_user_info->intro, intro_f, sizeof(intro_f), 0); + intro_len = lml_render(p_user_info->intro, intro_f, sizeof(intro_f), SCREEN_COLS, 0); snprintf(user_info_f, sizeof(user_info_f), "\n%s (%s) 上站 [%d] 发文 [%d]\n" @@ -178,7 +173,7 @@ int user_info_display(USER_INFO *p_user_ (intro_len > 0 ? "\033[0;36m个人说明档如下:\033[m" : "\033[0;36m没有个人说明档\033[m"), intro_f); - lines = split_data_lines(user_info_f, SCREEN_COLS, line_offsets, MIN(SCREEN_ROWS - 1, BBS_user_intro_max_line + 8), 1, NULL); + lines = split_data_lines(user_info_f, SCREEN_COLS + 1, line_offsets, MIN(SCREEN_ROWS - 1, BBS_user_intro_max_line + 8), 1, NULL); clearscr(); display_data(user_info_f, lines, line_offsets, 1, display_user_info_key_handler, DATA_READ_HELP);