--- lbbs/src/menu_proc.c 2025/11/05 01:04:06 1.46 +++ lbbs/src/menu_proc.c 2025/12/17 03:47:00 1.59 @@ -6,11 +6,17 @@ * Copyright (C) 2004-2025 Leaflet */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "article_cache.h" #include "article_favor_display.h" #include "article_view_log.h" #include "bbs.h" #include "bbs_cmd.h" +#include "bbs_net.h" +#include "chicken.h" #include "common.h" #include "io.h" #include "log.h" @@ -18,8 +24,10 @@ #include "menu.h" #include "section_list_display.h" #include "screen.h" +#include "user_info_update.h" #include "user_list_display.h" #include "user_priv.h" +#include #include #include #include @@ -62,6 +70,7 @@ int exec_mbem(void *param) c++; } +#ifdef _ENABLE_SHARED hdll = dlopen(s + 5, RTLD_LAZY); if (hdll) @@ -87,6 +96,25 @@ int exec_mbem(void *param) prints("失败原因:%s\r\n", dlerror()); press_any_key(); } +#else + (void)hdll; + (void)func; + + if (strcasecmp(c, "bbs_net") == 0) + { + bbs_net(); + } + else if (strcasecmp(c, "chicken_main") == 0) + { + chicken_main(); + } + else + { + clearscr(); + prints("未知入口 [%s] !!\r\n", c); + press_any_key(); + } +#endif } return REDRAW; @@ -97,6 +125,13 @@ int exit_bbs(void *param) return EXITBBS; } +int eula(void *param) +{ + display_file(DATA_EULA, 0); + + return REDRAW; +} + int license(void *param) { display_file(DATA_LICENSE, 0); @@ -140,11 +175,19 @@ int reload_bbs_conf(void *param) int shutdown_bbs(void *param) { - log_common("Notify main process to exit\n"); + char buf[2] = "N"; - if (kill(getppid(), SIGTERM) < 0) + clearscr(); + get_data(1, 1, "真的要关闭系统吗[y/N]? ", buf, sizeof(buf), 1); + + if (toupper(buf[0]) == 'Y') { - log_error("Send SIGTERM signal failed (%d)\n", errno); + log_common("Notify main process to exit by [%s]\n", BBS_username); + + if (kill(getppid(), SIGTERM) < 0) + { + log_error("Send SIGTERM signal failed (%d)\n", errno); + } } return REDRAW; @@ -239,6 +282,7 @@ int show_top10_menu(void *param) { static int show_top10 = 0; int ch = 0; + int loop; if (show_top10) { @@ -252,7 +296,7 @@ int show_top10_menu(void *param) if (display_menu(&top10_menu) == 0) { - while (!SYS_server_exit) + for (loop = 1; !SYS_server_exit && loop;) { iflush(); ch = igetch(100); @@ -262,18 +306,25 @@ int show_top10_menu(void *param) BBS_last_access_tm = time(NULL); } + if (user_online_update("TOP10_MENU") < 0) + { + log_error("user_online_update(TOP10_MENU) error\n"); + } + switch (ch) { case KEY_NULL: // broken pipe +#ifdef _DEBUG log_error("KEY_NULL\n"); - show_top10 = 0; - return 0; +#endif + loop = 0; + break; case KEY_TIMEOUT: if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) { log_error("User input timeout\n"); - show_top10 = 0; - return 0; + loop = 0; + break; } continue; case CR: @@ -281,7 +332,7 @@ int show_top10_menu(void *param) switch (menu_control(&top10_menu, ch)) { case EXITMENU: - ch = EXITMENU; + loop = 0; break; case REDRAW: clearscr(); @@ -294,11 +345,6 @@ int show_top10_menu(void *param) break; } } - - if (ch == EXITMENU) - { - break; - } } } @@ -356,4 +402,24 @@ int list_online_user(void *param) } return REDRAW; +} + +int edit_intro(void *param) +{ + if (user_intro_edit(BBS_priv.uid) < 0) + { + log_error("user_intro_edit(%d) error\n", BBS_priv.uid); + } + + return REDRAW; +} + +int edit_sign(void *param) +{ + if (user_sign_edit(BBS_priv.uid) < 0) + { + log_error("user_sign_edit(%d) error\n", BBS_priv.uid); + } + + return REDRAW; }