--- lbbs/src/menu_proc.c 2025/10/17 01:25:08 1.39 +++ lbbs/src/menu_proc.c 2025/11/04 13:49:51 1.44 @@ -1,18 +1,10 @@ -/*************************************************************************** - menu_proc.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 */ +/* + * menu_proc + * - handler functions of menu commands + * + * Copyright (C) 2004-2025 by Leaflet + */ #include "article_cache.h" #include "article_favor_display.h" @@ -26,6 +18,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 +36,16 @@ 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 +68,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 +111,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(); @@ -328,4 +336,24 @@ int favor_topic(void *param) } return REDRAW; +} + +int list_user(void *param) +{ + if (user_list_display(0) < 0) + { + log_error("user_list_display(all_user) error\n"); + } + + return REDRAW; +} + +int list_online_user(void *param) +{ + if (user_list_display(1) < 0) + { + log_error("user_list_display(online_user) error\n"); + } + + return REDRAW; }