--- lbbs/src/menu_proc.c 2025/10/14 06:27:44 1.37 +++ lbbs/src/menu_proc.c 2025/10/21 11:11:28 1.42 @@ -26,6 +26,7 @@ #include "menu.h" #include "section_list_display.h" #include "screen.h" +#include "user_list_display.h" #include "user_priv.h" #include #include @@ -43,10 +44,15 @@ int list_section(void *param) return REDRAW; } +typedef union exec_handler_t{ + void *p; + int (*handler)(); +} exec_handler; + int exec_mbem(void *param) { void *hdll; - int (*func)(); + exec_handler func; char *c, *s; char buf[FILE_PATH_LEN]; @@ -69,8 +75,10 @@ int exec_mbem(void *param) { char *error; - if ((func = dlsym(hdll, c ? c : "mod_main")) != NULL) - func(); + if ((func.p = dlsym(hdll, c ? c : "mod_main")) != NULL) + { + func.handler(); + } else if ((error = dlerror()) != NULL) { clearscr(); @@ -110,6 +118,13 @@ int copyright(void *param) return REDRAW; } +int version(void *param) +{ + display_file(DATA_VERSION, 1); + + return REDRAW; +} + int reload_bbs_conf(void *param) { clearscr(); @@ -237,7 +252,7 @@ int show_top10_menu(void *param) return NOREDRAW; } show_top10 = 1; - + clearscr(); show_top("", BBS_name, ""); show_bottom(""); @@ -248,20 +263,27 @@ int show_top10_menu(void *param) { iflush(); ch = igetch(100); + + if (ch != KEY_NULL && ch != KEY_TIMEOUT) + { + BBS_last_access_tm = time(NULL); + } + switch (ch) { case KEY_NULL: // broken pipe + log_error("KEY_NULL\n"); show_top10 = 0; return 0; case KEY_TIMEOUT: if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) { + log_error("User input timeout\n"); show_top10 = 0; return 0; } continue; case CR: - igetch_reset(); default: switch (menu_control(&top10_menu, ch)) { @@ -280,15 +302,13 @@ int show_top10_menu(void *param) } } - BBS_last_access_tm = time(NULL); - if (ch == EXITMENU) { break; } } } - + show_top10 = 0; return REDRAW; } @@ -323,4 +343,14 @@ int favor_topic(void *param) } return REDRAW; +} + +int user_list(void *param) +{ + if (user_list_display() < 0) + { + log_error("user_list_display() error\n"); + } + + return REDRAW; }