/[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.97 by sysadm, Tue Nov 4 13:49:51 2025 UTC Revision 1.105 by sysadm, Sat Nov 8 09:05:59 2025 UTC
# Line 3  Line 3 
3   * bbs_main   * bbs_main
4   *   - entry and major procedures of user interactive access   *   - entry and major procedures of user interactive access
5   *   *
6   * Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   */   */
8    
9  #include "article_favor.h"  #include "article_favor.h"
# Line 11  Line 11 
11  #include "bbs.h"  #include "bbs.h"
12  #include "bbs_cmd.h"  #include "bbs_cmd.h"
13  #include "bbs_main.h"  #include "bbs_main.h"
14    #include "bwf.h"
15  #include "common.h"  #include "common.h"
16  #include "database.h"  #include "database.h"
17  #include "editor.h"  #include "editor.h"
# Line 21  Line 22 
22  #include "screen.h"  #include "screen.h"
23  #include "section_list.h"  #include "section_list.h"
24  #include "section_list_display.h"  #include "section_list_display.h"
25    #include "str_process.h"
26  #include "trie_dict.h"  #include "trie_dict.h"
27  #include "user_list.h"  #include "user_list.h"
28  #include "user_priv.h"  #include "user_priv.h"
29    #include <ctype.h>
30  #include <errno.h>  #include <errno.h>
31  #include <signal.h>  #include <signal.h>
32  #include <stdlib.h>  #include <stdlib.h>
# Line 138  int bbs_center() Line 141  int bbs_center()
141                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)
142                  {                  {
143                          BBS_last_access_tm = time(NULL);                          BBS_last_access_tm = time(NULL);
144    #ifdef _DEBUG
145                            log_error("Debug: BBS_last_access_tm is updated\n");
146    #endif
147                  }                  }
148    
149                  if (bbs_menu.choose_step == 0 && time(NULL) - t_last_action >= 10)                  if (bbs_menu.choose_step == 0 && time(NULL) - t_last_action >= 10)
# Line 161  int bbs_center() Line 167  int bbs_center()
167                          log_error("KEY_NULL\n");                          log_error("KEY_NULL\n");
168                          return 0;                          return 0;
169                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
170                          if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                          if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
171                          {                          {
172                                  log_error("User input timeout\n");                                  log_error("User input timeout\n");
173                                  return 0;                                  return 0;
# Line 200  int bbs_charset_select() Line 206  int bbs_charset_select()
206          int ch;          int ch;
207    
208          snprintf(msg, sizeof(msg),          snprintf(msg, sizeof(msg),
209                           "\rChoose character set in 5 seconds [UTF-8, GBK]: [U/g]");                           "\rChoose character set in 5 seconds, (U)UTF-8, (G)GBK [U]: ");
210    
211          while (!SYS_server_exit)          while (!SYS_server_exit)
212          {          {
213                  ch = press_any_key_ex(msg, 5);                  ch = press_any_key_ex(msg, 5);
214                  switch (ch)                  switch (toupper(ch))
215                  {                  {
216                  case KEY_NULL:                  case KEY_NULL:
217                          return -1;                          return -1;
218                  case KEY_TIMEOUT:                  case KEY_TIMEOUT:
219                  case CR:                  case CR:
                 case 'u':  
220                  case 'U':                  case 'U':
221                          return 0;                          break;
                 case 'g':  
222                  case 'G':                  case 'G':
223                          if (io_conv_init("GBK") < 0)                          if (io_conv_init("GBK") < 0)
224                          {                          {
225                                  log_error("io_conv_init(%s) error\n", "GBK");                                  log_error("io_conv_init(%s) error\n", "GBK");
226                                  return -1;                                  return -1;
227                          }                          }
228                          return 0;                          break;
229                  default:                  default:
230                          continue;                          continue;
231                  }                  }
232    
233                    break;
234            }
235    
236            snprintf(msg, sizeof(msg),
237                             "\r请在5秒内选择宽字符显示规则, (D)动态, (F)固定? [D]: ");
238    
239            while (!SYS_server_exit)
240            {
241                    ch = press_any_key_ex(msg, 5);
242                    switch (toupper(ch))
243                    {
244                    case KEY_NULL:
245                            return -1;
246                    case KEY_TIMEOUT:
247                    case CR:
248                    case 'D':
249                            UTF8_fixed_width = 0;
250                            break;
251                    case 'F':
252                            UTF8_fixed_width = 1;
253                            break;
254                    default:
255                            continue;
256                    }
257    
258                    break;
259          }          }
260    
261          return 0;          return 0;
# Line 274  int bbs_main() Line 305  int bbs_main()
305          }          }
306    
307          // Set default charset          // Set default charset
308          if (io_conv_init(BBS_DEFAULT_CHARSET) < 0)          if (io_conv_init(BBS_default_charset) < 0)
309          {          {
310                  log_error("io_conv_init(%s) error\n", BBS_DEFAULT_CHARSET);                  log_error("io_conv_init(%s) error\n", BBS_default_charset);
311                  goto cleanup;                  goto cleanup;
312          }          }
313    
# Line 389  cleanup: Line 420  cleanup:
420          detach_article_block_shm();          detach_article_block_shm();
421          detach_trie_dict_shm();          detach_trie_dict_shm();
422    
423            // Cleanup BWF
424            bwf_unload();
425    
426          return 0;          return 0;
427  }  }


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

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