--- lbbs/src/bbs_main.c 2025/07/02 04:17:33 1.76 +++ lbbs/src/bbs_main.c 2025/10/16 05:24:52 1.80 @@ -14,6 +14,7 @@ * * ***************************************************************************/ +#include "article_favor.h" #include "article_view_log.h" #include "bbs.h" #include "bbs_cmd.h" @@ -38,7 +39,7 @@ int bbs_info() { - prints("欢迎光临 \033[1;33m%s \033[32m[%s] \033[37m( %s )\r\n", + prints("欢迎光临 \033[1;33m%s \033[32m[%s] \033[37m( %s )\033[m\r\n", BBS_name, BBS_server, APP_INFO); return iflush(); @@ -180,11 +181,16 @@ int bbs_logout(void) return -1; } - if (user_online_del(db) < 0) + if (user_online_exp(db) < 0) { return -2; } + if (user_online_del(db) < 0) + { + return -3; + } + mysql_close(db); display_file(DATA_GOODBYE, 1); @@ -339,6 +345,13 @@ int bbs_main() goto cleanup; } + // Load article favorite + if (article_favor_load(BBS_priv.uid, &BBS_article_favor, 0) < 0) + { + log_error("article_favor_load() error\n"); + goto cleanup; + } + // Init editor memory pool if (editor_memory_pool_init() < 0) { @@ -363,6 +376,12 @@ int bbs_main() log_error("article_view_log_save_inc() error\n"); } + // Save incremental article favorite + if (article_favor_save_inc(&BBS_article_favor) < 0) + { + log_error("article_favor_save_inc() error\n"); + } + cleanup: // Cleanup editor memory pool editor_memory_pool_cleanup(); @@ -370,8 +389,12 @@ cleanup: // Unload article view log article_view_log_unload(&BBS_article_view_log); + // Unload article favor + article_favor_unload(&BBS_article_favor); + // Detach menu in shared memory detach_menu_shm(&bbs_menu); + detach_menu_shm(&top10_menu); // Detach data pools shm detach_section_list_shm();