/[LeafOK_CVS]/lbbs/src/bbs_main.c
ViewVC logotype

Diff of /lbbs/src/bbs_main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.31 by sysadm, Mon Apr 28 03:30:59 2025 UTC Revision 1.35 by sysadm, Sun May 4 14:54:55 2025 UTC
# Line 15  Line 15 
15   *                                                                         *   *                                                                         *
16   ***************************************************************************/   ***************************************************************************/
17    
18    #include "bbs_main.h"
19  #include "bbs.h"  #include "bbs.h"
20    #include "welcome.h"
21    #include "login.h"
22    #include "user_priv.h"
23  #include "common.h"  #include "common.h"
24    #include "database.h"
25    #include "log.h"
26  #include "io.h"  #include "io.h"
27    #include "screen.h"
28  #include "menu.h"  #include "menu.h"
29  #include "bbs_cmd.h"  #include "bbs_cmd.h"
30    #include <unistd.h>
31  #include <time.h>  #include <time.h>
32  #include <string.h>  #include <string.h>
33    
 int bbs_main()  
 {  
         char temp[256];  
         int ret;  
   
         set_input_echo(0);  
   
         bbs_info();  
   
         // Welcome  
         bbs_welcome();  
   
         // Login  
         ret = bbs_login();  
         if (ret < 0)  
                 return -1;  
         log_std("User \"%s\"(%ld) login from %s:%d\n",  
                         BBS_username, BBS_priv.uid, hostaddr_client, port_client);  
         clearscr();  
   
         // BBS Top 10  
         strcpy(temp, app_home_dir);  
         strcat(temp, "data/bbs_top.txt");  
         display_file_ex(temp, 1, 1);  
   
         // Main  
         bbs_center();  
   
         // Logout  
         bbs_exit();  
         log_std("User logout\n");  
   
         return 0;  
 }  
   
34  int bbs_info()  int bbs_info()
35  {  {
36          prints("»¶Ó­¹âÁÙ \033[1;33m%s \033[32m[%s]  \033[37m( %s )\r\n",          prints("»¶Ó­¹âÁÙ \033[1;33m%s \033[32m[%s]  \033[37m( %s )\r\n",
# Line 70  int bbs_info() Line 43  int bbs_info()
43    
44  int bbs_exit()  int bbs_exit()
45  {  {
46          char temp[256];          display_file_ex(DATA_GOODBYE, 1, 0);
   
         strcpy(temp, app_home_dir);  
         strcat(temp, "data/goodbye.txt");  
         display_file_ex(temp, 1, 0);  
47    
48          sleep(1);          sleep(1);
49    
# Line 83  int bbs_exit() Line 52  int bbs_exit()
52    
53  int bbs_center()  int bbs_center()
54  {  {
55          int ch, result, redraw;          int ch, redraw;
         char temp[256];  
56          time_t t_last_action;          time_t t_last_action;
57    
58          BBS_last_access_tm = t_last_action = time(0);          BBS_last_access_tm = t_last_action = time(0);
# Line 98  int bbs_center() Line 66  int bbs_center()
66    
67          while (!SYS_exit)          while (!SYS_exit)
68          {          {
69                  ch = igetch();                  ch = igetch(0);
70    
71                  if (time(0) - t_last_action >= 10)                  if (time(0) - t_last_action >= 10)
72                  {                  {
# Line 145  int bbs_center() Line 113  int bbs_center()
113    
114          return 0;          return 0;
115  }  }
116    
117    int bbs_main()
118    {
119            int ret;
120    
121            set_input_echo(0);
122    
123            bbs_info();
124    
125            // Welcome
126            bbs_welcome();
127    
128            // Login
129            ret = bbs_login();
130            if (ret < 0)
131                    return -1;
132            log_std("User \"%s\"(%ld) login from %s:%d\n",
133                            BBS_username, BBS_priv.uid, hostaddr_client, port_client);
134            clearscr();
135    
136            // BBS Top 10
137            display_file_ex("./var/bbs_top.txt", 1, 1);
138    
139            // Main
140            bbs_center();
141    
142            // Logout
143            bbs_exit();
144            log_std("User logout\n");
145    
146            MYSQL *db = db_open();
147            if (db == NULL)
148            {
149                    return -1;
150            }
151    
152            user_online_del(db);
153    
154            mysql_close(db);
155    
156            return 0;
157    }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1