--- lbbs/src/bbs_main.c 2025/04/30 09:18:19 1.32 +++ lbbs/src/bbs_main.c 2025/05/06 05:31:26 1.36 @@ -1,16 +1,15 @@ /*************************************************************************** bbs_main.c - description ------------------- - begin : Mon Oct 18 2004 - copyright : (C) 2004 by Leaflet - email : leaflet@leafok.com + 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 2 of the License, or * + * the Free Software Foundation; either version 3 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ @@ -21,6 +20,7 @@ #include "login.h" #include "user_priv.h" #include "common.h" +#include "database.h" #include "log.h" #include "io.h" #include "screen.h" @@ -42,11 +42,7 @@ int bbs_info() int bbs_exit() { - char temp[256]; - - strcpy(temp, app_home_dir); - strcat(temp, "data/goodbye.txt"); - display_file_ex(temp, 1, 0); + display_file_ex(DATA_GOODBYE, 1, 0); sleep(1); @@ -55,8 +51,7 @@ int bbs_exit() int bbs_center() { - int ch, result, redraw; - char temp[256]; + int ch, redraw; time_t t_last_action; BBS_last_access_tm = t_last_action = time(0); @@ -70,7 +65,7 @@ int bbs_center() while (!SYS_exit) { - ch = igetch(); + ch = igetch(0); if (time(0) - t_last_action >= 10) { @@ -120,7 +115,6 @@ int bbs_center() int bbs_main() { - char temp[256]; int ret; set_input_echo(0); @@ -139,9 +133,7 @@ int bbs_main() clearscr(); // BBS Top 10 - strcpy(temp, app_home_dir); - strcat(temp, "data/bbs_top.txt"); - display_file_ex(temp, 1, 1); + display_file_ex("./var/bbs_top.txt", 1, 1); // Main bbs_center(); @@ -150,5 +142,15 @@ int bbs_main() bbs_exit(); log_std("User logout\n"); + MYSQL *db = db_open(); + if (db == NULL) + { + return -1; + } + + user_online_del(db); + + mysql_close(db); + return 0; }