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

Diff of /lbbs/src/menu_proc.c

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

Revision 1.35 by sysadm, Mon Oct 13 07:35:48 2025 UTC Revision 1.41 by sysadm, Sat Oct 18 12:06:10 2025 UTC
# Line 15  Line 15 
15   ***************************************************************************/   ***************************************************************************/
16    
17  #include "article_cache.h"  #include "article_cache.h"
18    #include "article_favor_display.h"
19  #include "article_view_log.h"  #include "article_view_log.h"
20  #include "bbs.h"  #include "bbs.h"
21  #include "bbs_cmd.h"  #include "bbs_cmd.h"
# Line 42  int list_section(void *param) Line 43  int list_section(void *param)
43          return REDRAW;          return REDRAW;
44  }  }
45    
46    typedef union exec_handler_t{
47            void *p;
48            int (*handler)();
49    } exec_handler;
50    
51  int exec_mbem(void *param)  int exec_mbem(void *param)
52  {  {
53          void *hdll;          void *hdll;
54          int (*func)();          exec_handler func;
55          char *c, *s;          char *c, *s;
56          char buf[FILE_PATH_LEN];          char buf[FILE_PATH_LEN];
57    
# Line 68  int exec_mbem(void *param) Line 74  int exec_mbem(void *param)
74                  {                  {
75                          char *error;                          char *error;
76    
77                          if ((func = dlsym(hdll, c ? c : "mod_main")) != NULL)                          if ((func.p = dlsym(hdll, c ? c : "mod_main")) != NULL)
78                                  func();                          {
79                                    func.handler();
80                            }
81                          else if ((error = dlerror()) != NULL)                          else if ((error = dlerror()) != NULL)
82                          {                          {
83                                  clearscr();                                  clearscr();
# Line 109  int copyright(void *param) Line 117  int copyright(void *param)
117          return REDRAW;          return REDRAW;
118  }  }
119    
120    int version(void *param)
121    {
122            display_file(DATA_VERSION, 1);
123    
124            return REDRAW;
125    }
126    
127  int reload_bbs_conf(void *param)  int reload_bbs_conf(void *param)
128  {  {
129          clearscr();          clearscr();
# Line 211  int list_ex_section(void *param) Line 226  int list_ex_section(void *param)
226  {  {
227          SECTION_LIST *p_section;          SECTION_LIST *p_section;
228    
229          p_section = section_list_find_by_name(param, NULL);          p_section = section_list_find_by_name(param);
230          if (p_section == NULL)          if (p_section == NULL)
231          {          {
232                  log_error("Section %s not found\n", (const char *)param);                  log_error("Section %s not found\n", (const char *)param);
# Line 236  int show_top10_menu(void *param) Line 251  int show_top10_menu(void *param)
251                  return NOREDRAW;                  return NOREDRAW;
252          }          }
253          show_top10 = 1;          show_top10 = 1;
254            
255          clearscr();          clearscr();
256          show_top("", BBS_name, "");          show_top("", BBS_name, "");
257          show_bottom("");          show_bottom("");
# Line 247  int show_top10_menu(void *param) Line 262  int show_top10_menu(void *param)
262                  {                  {
263                          iflush();                          iflush();
264                          ch = igetch(100);                          ch = igetch(100);
265    
266                            if (ch != KEY_NULL && ch != KEY_TIMEOUT)
267                            {
268                                    BBS_last_access_tm = time(NULL);
269                            }
270    
271                          switch (ch)                          switch (ch)
272                          {                          {
273                          case KEY_NULL: // broken pipe                          case KEY_NULL: // broken pipe
274                                    log_error("KEY_NULL\n");
275                                  show_top10 = 0;                                  show_top10 = 0;
276                                  return 0;                                  return 0;
277                          case KEY_TIMEOUT:                          case KEY_TIMEOUT:
278                                  if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                                  if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
279                                  {                                  {
280                                            log_error("User input timeout\n");
281                                          show_top10 = 0;                                          show_top10 = 0;
282                                          return 0;                                          return 0;
283                                  }                                  }
284                                  continue;                                  continue;
285                          case CR:                          case CR:
                                 igetch_reset();  
286                          default:                          default:
287                                  switch (menu_control(&top10_menu, ch))                                  switch (menu_control(&top10_menu, ch))
288                                  {                                  {
# Line 279  int show_top10_menu(void *param) Line 301  int show_top10_menu(void *param)
301                                  }                                  }
302                          }                          }
303    
                         BBS_last_access_tm = time(NULL);  
   
304                          if (ch == EXITMENU)                          if (ch == EXITMENU)
305                          {                          {
306                                  break;                                  break;
307                          }                          }
308                  }                  }
309          }          }
310            
311          show_top10 = 0;          show_top10 = 0;
312          return REDRAW;          return REDRAW;
313  }  }
# Line 316  int locate_article(void *param) Line 336  int locate_article(void *param)
336    
337  int favor_topic(void *param)  int favor_topic(void *param)
338  {  {
339          clearscr();          if (article_favor_display(&BBS_article_favor) < 0)
340          prints("此功能尚未实现");          {
341          press_any_key();                  log_error("article_favor_display() error\n");
342            }
343    
344          return REDRAW;          return REDRAW;
345  }  }


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

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