/[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.32 by sysadm, Wed Apr 30 09:18:19 2025 UTC Revision 1.39 by sysadm, Sat May 10 11:09:02 2025 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2                                                    bbs_main.c  -  description                                                    bbs_main.c  -  description
3                                                           -------------------                                                           -------------------
4          begin                : Mon Oct 18 2004          Copyright            : (C) 2004-2025 by Leaflet
5          copyright            : (C) 2004 by Leaflet          Email                : leaflet@leafok.com
         email                : leaflet@leafok.com  
6   ***************************************************************************/   ***************************************************************************/
7    
8  /***************************************************************************  /***************************************************************************
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
12   *   the Free Software Foundation; either version 2 of the License, or     *   *   the Free Software Foundation; either version 3 of the License, or     *
13   *   (at your option) any later version.                                   *   *   (at your option) any later version.                                   *
14   *                                                                         *   *                                                                         *
15   ***************************************************************************/   ***************************************************************************/
# Line 21  Line 20 
20  #include "login.h"  #include "login.h"
21  #include "user_priv.h"  #include "user_priv.h"
22  #include "common.h"  #include "common.h"
23    #include "database.h"
24  #include "log.h"  #include "log.h"
25  #include "io.h"  #include "io.h"
26  #include "screen.h"  #include "screen.h"
# Line 42  int bbs_info() Line 42  int bbs_info()
42    
43  int bbs_exit()  int bbs_exit()
44  {  {
45          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);  
46    
47          sleep(1);          sleep(1);
48    
# Line 55  int bbs_exit() Line 51  int bbs_exit()
51    
52  int bbs_center()  int bbs_center()
53  {  {
54          int ch, result, redraw;          int ch;
         char temp[256];  
55          time_t t_last_action;          time_t t_last_action;
56    
57          BBS_last_access_tm = t_last_action = time(0);          BBS_last_access_tm = t_last_action = time(0);
# Line 68  int bbs_center() Line 63  int bbs_center()
63          show_bottom("");          show_bottom("");
64          display_menu(get_menu(&bbs_menu, "TOPMENU"));          display_menu(get_menu(&bbs_menu, "TOPMENU"));
65    
66          while (!SYS_exit)          while (!SYS_server_exit)
67          {          {
68                  ch = igetch();                  ch = igetch(0);
69    
70                  if (time(0) - t_last_action >= 10)                  if (time(0) - t_last_action >= 10)
71                  {                  {
# Line 82  int bbs_center() Line 77  int bbs_center()
77                  switch (ch)                  switch (ch)
78                  {                  {
79                  case KEY_NULL:                  case KEY_NULL:
80                          return 0;                          return -1;
81                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
82                          if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME)                          if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME)
83                          {                          {
84                                  return -1;                                  return 0;
85                          }                          }
86                          continue;                          continue;
87                  default:                  default:
                         redraw = 1;  
88                          switch (menu_control(&bbs_menu, ch))                          switch (menu_control(&bbs_menu, ch))
89                          {                          {
90                          case EXITBBS:                          case EXITBBS:
91                                  return 0;                                  return 0;
92                          case REDRAW:                          case REDRAW:
                                 break;  
                         case NOREDRAW:  
                         case UNKNOWN_CMD:  
                         default:  
                                 redraw = 0;  
                                 break;  
                         }  
                         if (redraw)  
                         {  
93                                  clearscr();                                  clearscr();
94                                  show_top("");                                  show_top("");
95                                  show_active_board();                                  show_active_board();
96                                  show_bottom("");                                  show_bottom("");
97                                  display_current_menu(&bbs_menu);                                  display_current_menu(&bbs_menu);
98                                    break;
99                            case NOREDRAW:
100                            case UNKNOWN_CMD:
101                            default:
102                                    break;
103                          }                          }
104                  }                  }
105                  BBS_last_access_tm = time(0);                  BBS_last_access_tm = time(0);
# Line 120  int bbs_center() Line 110  int bbs_center()
110    
111  int bbs_main()  int bbs_main()
112  {  {
         char temp[256];  
113          int ret;          int ret;
114    
115          set_input_echo(0);          set_input_echo(0);
# Line 139  int bbs_main() Line 128  int bbs_main()
128          clearscr();          clearscr();
129    
130          // BBS Top 10          // BBS Top 10
131          strcpy(temp, app_home_dir);          display_file_ex("./var/bbs_top.txt", 1, 1);
         strcat(temp, "data/bbs_top.txt");  
         display_file_ex(temp, 1, 1);  
132    
133          // Main          // Main
134          bbs_center();          bbs_center();
# Line 150  int bbs_main() Line 137  int bbs_main()
137          bbs_exit();          bbs_exit();
138          log_std("User logout\n");          log_std("User logout\n");
139    
140            MYSQL *db = db_open();
141            if (db == NULL)
142            {
143                    return -1;
144            }
145    
146            user_online_del(db);
147    
148            mysql_close(db);
149    
150          return 0;          return 0;
151  }  }


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

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