/[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.34 by sysadm, Mon Oct 13 07:13:39 2025 UTC Revision 1.43 by sysadm, Wed Oct 22 04:48:53 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 25  Line 26 
26  #include "menu.h"  #include "menu.h"
27  #include "section_list_display.h"  #include "section_list_display.h"
28  #include "screen.h"  #include "screen.h"
29    #include "user_list_display.h"
30  #include "user_priv.h"  #include "user_priv.h"
31  #include <dlfcn.h>  #include <dlfcn.h>
32  #include <errno.h>  #include <errno.h>
# Line 42  int list_section(void *param) Line 44  int list_section(void *param)
44          return REDRAW;          return REDRAW;
45  }  }
46    
47    typedef union exec_handler_t{
48            void *p;
49            int (*handler)();
50    } exec_handler;
51    
52  int exec_mbem(void *param)  int exec_mbem(void *param)
53  {  {
54          void *hdll;          void *hdll;
55          int (*func)();          exec_handler func;
56          char *c, *s;          char *c, *s;
57          char buf[FILE_PATH_LEN];          char buf[FILE_PATH_LEN];
58    
# Line 68  int exec_mbem(void *param) Line 75  int exec_mbem(void *param)
75                  {                  {
76                          char *error;                          char *error;
77    
78                          if ((func = dlsym(hdll, c ? c : "mod_main")) != NULL)                          if ((func.p = dlsym(hdll, c ? c : "mod_main")) != NULL)
79                                  func();                          {
80                                    func.handler();
81                            }
82                          else if ((error = dlerror()) != NULL)                          else if ((error = dlerror()) != NULL)
83                          {                          {
84                                  clearscr();                                  clearscr();
# Line 109  int copyright(void *param) Line 118  int copyright(void *param)
118          return REDRAW;          return REDRAW;
119  }  }
120    
121    int version(void *param)
122    {
123            display_file(DATA_VERSION, 1);
124    
125            return REDRAW;
126    }
127    
128  int reload_bbs_conf(void *param)  int reload_bbs_conf(void *param)
129  {  {
130          clearscr();          clearscr();
# Line 211  int list_ex_section(void *param) Line 227  int list_ex_section(void *param)
227  {  {
228          SECTION_LIST *p_section;          SECTION_LIST *p_section;
229    
230          p_section = section_list_find_by_name(param, NULL);          p_section = section_list_find_by_name(param);
231          if (p_section == NULL)          if (p_section == NULL)
232          {          {
233                  log_error("Section %s not found\n", (const char *)param);                  log_error("Section %s not found\n", (const char *)param);
# Line 228  int list_ex_section(void *param) Line 244  int list_ex_section(void *param)
244    
245  int show_top10_menu(void *param)  int show_top10_menu(void *param)
246  {  {
247            static int show_top10 = 0;
248          int ch = 0;          int ch = 0;
249    
250            if (show_top10)
251            {
252                    return NOREDRAW;
253            }
254            show_top10 = 1;
255    
256          clearscr();          clearscr();
257          show_top("", BBS_name, "");          show_top("", BBS_name, "");
258          show_bottom("");          show_bottom("");
# Line 240  int show_top10_menu(void *param) Line 263  int show_top10_menu(void *param)
263                  {                  {
264                          iflush();                          iflush();
265                          ch = igetch(100);                          ch = igetch(100);
266    
267                            if (ch != KEY_NULL && ch != KEY_TIMEOUT)
268                            {
269                                    BBS_last_access_tm = time(NULL);
270                            }
271    
272                          switch (ch)                          switch (ch)
273                          {                          {
274                          case KEY_NULL: // broken pipe                          case KEY_NULL: // broken pipe
275                                    log_error("KEY_NULL\n");
276                                    show_top10 = 0;
277                                  return 0;                                  return 0;
278                          case KEY_TIMEOUT:                          case KEY_TIMEOUT:
279                                  if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)                                  if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
280                                  {                                  {
281                                            log_error("User input timeout\n");
282                                            show_top10 = 0;
283                                          return 0;                                          return 0;
284                                  }                                  }
285                                  continue;                                  continue;
286                          case CR:                          case CR:
                                 igetch_reset();  
287                          default:                          default:
288                                  switch (menu_control(&top10_menu, ch))                                  switch (menu_control(&top10_menu, ch))
289                                  {                                  {
# Line 270  int show_top10_menu(void *param) Line 302  int show_top10_menu(void *param)
302                                  }                                  }
303                          }                          }
304    
                         BBS_last_access_tm = time(NULL);  
   
305                          if (ch == EXITMENU)                          if (ch == EXITMENU)
306                          {                          {
307                                  break;                                  break;
308                          }                          }
309                  }                  }
310          }          }
311            
312            show_top10 = 0;
313          return REDRAW;          return REDRAW;
314  }  }
315    
# Line 306  int locate_article(void *param) Line 337  int locate_article(void *param)
337    
338  int favor_topic(void *param)  int favor_topic(void *param)
339  {  {
340          clearscr();          if (article_favor_display(&BBS_article_favor) < 0)
341          prints("此功能尚未实现");          {
342          press_any_key();                  log_error("article_favor_display() error\n");
343            }
344    
345            return REDRAW;
346    }
347    
348    int list_user(void *param)
349    {
350            if (user_list_display(0) < 0)
351            {
352                    log_error("user_list_display(all_user) error\n");
353            }
354    
355            return REDRAW;
356    }
357    
358    int list_online_user(void *param)
359    {
360            if (user_list_display(1) < 0)
361            {
362                    log_error("user_list_display(online_user) error\n");
363            }
364    
365          return REDRAW;          return REDRAW;
366  }  }


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

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