--- lbbs/src/screen.c 2025/06/12 12:53:49 1.96 +++ lbbs/src/screen.c 2025/06/29 01:57:15 1.103 @@ -14,26 +14,25 @@ * * ***************************************************************************/ -#include "screen.h" #include "bbs.h" #include "common.h" -#include "str_process.h" -#include "log.h" -#include "io.h" #include "editor.h" #include "file_loader.h" -#include +#include "io.h" +#include "log.h" +#include "login.h" +#include "screen.h" +#include "str_process.h" #include -#include -#include #include -#include -#include +#include +#include +#include +#include #include +#include #include - -#define _POSIX_C_SOURCE 200809L -#include +#include #define ACTIVE_BOARD_HEIGHT 8 @@ -301,7 +300,7 @@ int display_data(const void *p_data, lon percentile, ctx.msg); - len = split_line(buffer, SCREEN_COLS, &eol, &display_len); + len = split_line(buffer, SCREEN_COLS, &eol, &display_len, 1); for (; display_len < SCREEN_COLS; display_len++) { buffer[len++] = ' '; @@ -374,7 +373,8 @@ int display_data(const void *p_data, lon output_end_row = SCREEN_ROWS - 1; moveto(SCREEN_ROWS, 0); clrtoeol(); - prints("\033[S"); // Scroll up 1 line + //prints("\033[S"); // Scroll up 1 line + prints("\n"); // Legacy Cterm only works with this line break; case KEY_PGUP: if (line_current - output_current_row < 0) // Reach begin @@ -431,7 +431,7 @@ int display_data(const void *p_data, lon break; } - BBS_last_access_tm = time(0); + BBS_last_access_tm = time(NULL); } continue; @@ -495,6 +495,11 @@ int display_file(const char *filename, i return KEY_NULL; } + if (user_online_update("VIEW_FILE") < 0) + { + log_error("user_online_update(VIEW_FILE) error\n"); + } + ret = display_data(p_data, line_total, p_line_offsets, eof_exit, display_file_key_handler, DATA_READ_HELP); if (detach_file_shm(p_shm) < 0) @@ -518,17 +523,17 @@ int show_top(const char *str_left, const strncpy(str_left_f, str_left, sizeof(str_left_f) - 1); str_left_f[sizeof(str_left_f) - 1] = '\0'; - len = split_line(str_left_f, STR_TOP_LEFT_MAX_LEN, &eol, &str_left_len); + len = split_line(str_left_f, STR_TOP_LEFT_MAX_LEN, &eol, &str_left_len, 1); str_left_f[len] = '\0'; strncpy(str_middle_f, str_middle, sizeof(str_middle_f) - 1); str_middle_f[sizeof(str_middle_f) - 1] = '\0'; - len = split_line(str_middle, STR_TOP_MIDDLE_MAX_LEN, &eol, &str_middle_len); + len = split_line(str_middle, STR_TOP_MIDDLE_MAX_LEN, &eol, &str_middle_len, 1); str_middle_f[len] = '\0'; strncpy(str_right_f, str_right, sizeof(str_right_f) - 1); str_right_f[sizeof(str_right_f) - 1] = '\0'; - len = split_line(str_right, STR_TOP_RIGHT_MAX_LEN, &eol, &str_right_len); + len = split_line(str_right, STR_TOP_RIGHT_MAX_LEN, &eol, &str_right_len, 1); str_right_f[len] = '\0'; moveto(1, 0); @@ -559,13 +564,13 @@ int show_bottom(const char *msg) { strncpy(msg_f, msg, sizeof(msg_f) - 1); msg_f[sizeof(msg_f) - 1] = '\0'; - len = split_line(msg_f, 23, &eol, &msg_len); + len = split_line(msg_f, 23, &eol, &msg_len, 1); msg_f[len] = '\0'; } len_username = (int)strnlen(BBS_username, sizeof(BBS_username)); - time_online = time(0) - BBS_login_tm; + time_online = time(NULL) - BBS_login_tm; tm_online = gmtime(&time_online); if (tm_online->tm_mday > 1) { @@ -612,10 +617,10 @@ int show_active_board() } } - if (time(0) - t_last_show >= 10) + if (time(NULL) - t_last_show >= 10) { line_last = line_current; - t_last_show = time(0); + t_last_show = time(NULL); } else {