--- lbbs/src/menu_proc.c 2025/10/13 02:23:27 1.31 +++ lbbs/src/menu_proc.c 2025/10/17 12:23:01 1.40 @@ -15,6 +15,7 @@ ***************************************************************************/ #include "article_cache.h" +#include "article_favor_display.h" #include "article_view_log.h" #include "bbs.h" #include "bbs_cmd.h" @@ -109,6 +110,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(); @@ -141,7 +149,7 @@ int shutdown_bbs(void *param) return REDRAW; } -int favour_section_filter(void *param) +int favor_section_filter(void *param) { MENU_ITEM *p_menu_item = param; @@ -211,7 +219,7 @@ int list_ex_section(void *param) { SECTION_LIST *p_section; - p_section = section_list_find_by_name(param, NULL); + p_section = section_list_find_by_name(param); if (p_section == NULL) { log_error("Section %s not found\n", (const char *)param); @@ -224,4 +232,107 @@ int list_ex_section(void *param) } return REDRAW; +} + +int show_top10_menu(void *param) +{ + static int show_top10 = 0; + int ch = 0; + + if (show_top10) + { + return NOREDRAW; + } + show_top10 = 1; + + clearscr(); + show_top("", BBS_name, ""); + show_bottom(""); + + if (display_menu(&top10_menu) == 0) + { + while (!SYS_server_exit) + { + 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: + default: + switch (menu_control(&top10_menu, ch)) + { + case EXITMENU: + ch = EXITMENU; + break; + case REDRAW: + clearscr(); + show_bottom(""); + display_menu(&top10_menu); + break; + case NOREDRAW: + case UNKNOWN_CMD: + default: + break; + } + } + + if (ch == EXITMENU) + { + break; + } + } + } + + show_top10 = 0; + return REDRAW; +} + +int locate_article(void *param) +{ + char buf[MAX_MENUITEM_NAME_LENGTH]; + char *sname, *aid, *saveptr; + + strncpy(buf, param, sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; + + sname = strtok_r(buf, "|", &saveptr); + aid = strtok_r(NULL, "|", &saveptr); + + if (sname == NULL || aid == NULL) + { + log_error("top10_locate(%s) error: invalid parameter\n", param); + return NOREDRAW; + } + + section_list_display(sname, atoi(aid)); + + return REDRAW; +} + +int favor_topic(void *param) +{ + if (article_favor_display(&BBS_article_favor) < 0) + { + log_error("article_favor_display() error\n"); + } + + return REDRAW; }