--- lbbs/src/menu_proc.c 2025/05/08 08:05:58 1.12 +++ lbbs/src/menu_proc.c 2025/06/17 13:17:04 1.26 @@ -21,22 +21,31 @@ #include "io.h" #include "screen.h" #include "menu.h" +#include "user_priv.h" +#include "section_list_display.h" #include #include #include #include -#include #include #include +#include + +int list_section(void *param) +{ + section_list_display(param); + + return REDRAW; +} -int exec_mbem(const char *str) +int exec_mbem(void *param) { void *hdll; int (*func)(); char *c, *s; char buf[FILE_PATH_LEN]; - strncpy(buf, str, sizeof(buf) - 1); + strncpy(buf, (const char *)param, sizeof(buf) - 1); buf[sizeof(buf) - 1] = '\0'; s = strstr(buf, "@mod:"); @@ -77,53 +86,38 @@ int exec_mbem(const char *str) return REDRAW; } -int exitbbs(const char *s) +int exit_bbs(void *param) { return EXITBBS; } -int license(const char *s) +int license(void *param) { - display_file_ex(DATA_LICENSE, 1, 1); + display_file(DATA_LICENSE, 0); return REDRAW; } -int copyright(const char *s) +int copyright(void *param) { - display_file_ex(DATA_COPYRIGHT, 1, 1); + display_file(DATA_COPYRIGHT, 1); return REDRAW; } -int reloadbbsmenu(const char *s) +int reload_bbs_conf(void *param) { - MENU_SET new_menu; - clearscr(); - if (load_menu(&new_menu, CONF_MENU) < 0) + if (kill(getppid(), SIGHUP) < 0) { - log_error("Reload menu failed\n"); + log_error("Send SIGHUP signal failed (%d)\n", errno); - unload_menu(&new_menu); - - prints("菜单配置校验失败\r\n"); + prints("发送指令失败\r\n"); } else { - unload_menu(&new_menu); - - if (kill(getppid(), SIG_RELOAD_MENU) < 0) - { - log_error("Send SIG_RELOAD_MENU signal failed (%d)\n", errno); - - prints("发送指令失败\r\n"); - } - else - { - prints("已发送指令\r\n"); - } + prints("已发送指令\r\n"); } press_any_key(); @@ -131,12 +125,21 @@ int reloadbbsmenu(const char *s) return REDRAW; } -int shutdownbbs(const char *s) +int shutdown_bbs(void *param) { - if (kill(0, SIGTERM) < 0) + log_common("Notify main process to exit\n"); + + if (kill(getppid(), SIGTERM) < 0) { log_error("Send SIGTERM signal failed (%d)\n", errno); } return REDRAW; } + +int favour_section_filter(void *param) +{ + MENU_ITEM *p_menu_item = param; + + return (is_favor(&BBS_priv, p_menu_item->priv) && checklevel2(&BBS_priv, p_menu_item->level)); +}