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

Diff of /lbbs/src/screen.c

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

Revision 1.121 by sysadm, Tue Nov 4 13:49:51 2025 UTC Revision 1.126 by sysadm, Fri Nov 7 13:22:57 2025 UTC
# Line 3  Line 3 
3   * screen   * screen
4   *   - advanced telnet-based user interactive input / output features   *   - advanced telnet-based user interactive input / output features
5   *   *
6   * Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   */   */
8    
9  #include "bbs.h"  #include "bbs.h"
# Line 26  Line 26 
26  #include <sys/shm.h>  #include <sys/shm.h>
27  #include <sys/types.h>  #include <sys/types.h>
28    
29  #define ACTIVE_BOARD_HEIGHT 8  const char CTRL_SEQ_CLR_LINE[] = "\033[K";
30    
31  #define STR_TOP_LEFT_MAX_LEN 80  static const int ACTIVE_BOARD_HEIGHT = 8;
32  #define STR_TOP_MIDDLE_MAX_LEN 40  
33  #define STR_TOP_RIGHT_MAX_LEN 80  static const int STR_TOP_LEFT_MAX_LEN = 80;
34    static const int STR_TOP_MIDDLE_MAX_LEN = 40;
35    static const int STR_TOP_RIGHT_MAX_LEN = 80;
36    
37  static size_t get_time_str(char *s, size_t len)  static size_t get_time_str(char *s, size_t len)
38  {  {
# Line 127  void set_input_echo(int echo) Line 129  void set_input_echo(int echo)
129          iflush();          iflush();
130  }  }
131    
132  static int _str_input(char *buffer, int buf_size, int max_display_len, int echo_mode)  static int _str_input(char *buffer, int buf_size, int max_display_len, enum io_echo_t echo_mode)
133  {  {
134          int ch;          int ch;
135          int offset = 0;          int offset = 0;
# Line 144  static int _str_input(char *buffer, int Line 146  static int _str_input(char *buffer, int
146    
147          while (!SYS_server_exit)          while (!SYS_server_exit)
148          {          {
149                  ch = igetch_t(MIN(MAX_DELAY_TIME, 60));                  ch = igetch_t(MIN(BBS_max_user_idle_time, 60));
150    
151                  if (ch == CR)                  if (ch == CR)
152                  {                  {
# Line 271  static int _str_input(char *buffer, int Line 273  static int _str_input(char *buffer, int
273          return offset;          return offset;
274  }  }
275    
276  int str_input(char *buffer, int buf_size, int echo_mode)  int str_input(char *buffer, int buf_size, enum io_echo_t echo_mode)
277  {  {
278          int len;          int len;
279    
# Line 314  int get_data(int row, int col, char *pro Line 316  int get_data(int row, int col, char *pro
316    
317          while (!SYS_server_exit)          while (!SYS_server_exit)
318          {          {
319                  ch = igetch_t(MIN(MAX_DELAY_TIME, 60));                  ch = igetch_t(MIN(BBS_max_user_idle_time, 60));
320    
321                  if (ch == CR)                  if (ch == CR)
322                  {                  {
# Line 590  int display_data(const void *p_data, lon Line 592  int display_data(const void *p_data, lon
592          loop = 1;          loop = 1;
593          while (!SYS_server_exit && loop)          while (!SYS_server_exit && loop)
594          {          {
595                  if (eof_exit > 0 && line_current >= display_line_total && display_line_total <= screen_row_total)                  if (eof_exit > 0 && line_current >= display_line_total)
596                  {                  {
597                          if (eof_exit == 1)                          if (eof_exit == 1)
598                          {                          {
# Line 645  int display_data(const void *p_data, lon Line 647  int display_data(const void *p_data, lon
647                          input_ok = 0;                          input_ok = 0;
648                          while (!SYS_server_exit && !input_ok)                          while (!SYS_server_exit && !input_ok)
649                          {                          {
650                                  ch = igetch_t(MAX_DELAY_TIME);                                  ch = igetch_t(BBS_max_user_idle_time);
651                                  input_ok = 1;                                  input_ok = 1;
652    
653                                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)                                  if (ch != KEY_NULL && ch != KEY_TIMEOUT)
# Line 800  cleanup: Line 802  cleanup:
802          return ch;          return ch;
803  }  }
804    
805  static int display_file_key_handler(int *p_key, DISPLAY_CTX *p_ctx)  int display_file_key_handler(int *p_key, DISPLAY_CTX *p_ctx)
806  {  {
807          switch (*p_key)          switch (*p_key)
808          {          {
# Line 892  int show_bottom(const char *msg) Line 894  int show_bottom(const char *msg)
894          int len;          int len;
895          int len_username;          int len_username;
896          char str_tm_online[LINE_BUFFER_LEN];          char str_tm_online[LINE_BUFFER_LEN];
897            int len_str_tm_online;
898    
899          len_str_time = (int)get_time_str(str_time, sizeof(str_time));          len_str_time = (int)get_time_str(str_time, sizeof(str_time));
900    
# Line 921  int show_bottom(const char *msg) Line 924  int show_bottom(const char *msg)
924                                   "\033[36m%d\033[33m:\033[36m%.2d",                                   "\033[36m%d\033[33m:\033[36m%.2d",
925                                   tm_online->tm_hour, tm_online->tm_min);                                   tm_online->tm_hour, tm_online->tm_min);
926          }          }
927            len_str_tm_online = str_length(str_tm_online, 1);
928    
929          moveto(SCREEN_ROWS, 0);          moveto(SCREEN_ROWS, 0);
930          clrtoeol();          clrtoeol();
931          prints("\033[1;44;33m时间[\033[36m%s\033[33m]%s%*s \033[33m用户[\033[36m%s\033[33m][%s\033[33m]\033[m",          prints("\033[1;44;33m时间[\033[36m%s\033[33m]%s%*s \033[33m用户[\033[36m%s\033[33m][%s\033[33m]\033[m",
932                     str_time, msg_f, 61 - len_str_time - len_msg - len_username, "", BBS_username, str_tm_online);                     str_time, msg_f, 65 - len_str_time - len_msg - len_username - len_str_tm_online, "", BBS_username, str_tm_online);
933    
934          return 0;          return 0;
935  }  }


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

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