/[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.31 by sysadm, Mon Oct 13 02:23:27 2025 UTC Revision 1.40 by sysadm, Fri Oct 17 12:23:01 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 109  int copyright(void *param) Line 110  int copyright(void *param)
110          return REDRAW;          return REDRAW;
111  }  }
112    
113    int version(void *param)
114    {
115            display_file(DATA_VERSION, 1);
116    
117            return REDRAW;
118    }
119    
120  int reload_bbs_conf(void *param)  int reload_bbs_conf(void *param)
121  {  {
122          clearscr();          clearscr();
# Line 141  int shutdown_bbs(void *param) Line 149  int shutdown_bbs(void *param)
149          return REDRAW;          return REDRAW;
150  }  }
151    
152  int favour_section_filter(void *param)  int favor_section_filter(void *param)
153  {  {
154          MENU_ITEM *p_menu_item = param;          MENU_ITEM *p_menu_item = param;
155    
# Line 211  int list_ex_section(void *param) Line 219  int list_ex_section(void *param)
219  {  {
220          SECTION_LIST *p_section;          SECTION_LIST *p_section;
221    
222          p_section = section_list_find_by_name(param, NULL);          p_section = section_list_find_by_name(param);
223          if (p_section == NULL)          if (p_section == NULL)
224          {          {
225                  log_error("Section %s not found\n", (const char *)param);                  log_error("Section %s not found\n", (const char *)param);
# Line 224  int list_ex_section(void *param) Line 232  int list_ex_section(void *param)
232          }          }
233    
234          return REDRAW;          return REDRAW;
235    }
236    
237    int show_top10_menu(void *param)
238    {
239            static int show_top10 = 0;
240            int ch = 0;
241    
242            if (show_top10)
243            {
244                    return NOREDRAW;
245            }
246            show_top10 = 1;
247    
248            clearscr();
249            show_top("", BBS_name, "");
250            show_bottom("");
251    
252            if (display_menu(&top10_menu) == 0)
253            {
254                    while (!SYS_server_exit)
255                    {
256                            iflush();
257                            ch = igetch(100);
258    
259                            if (ch != KEY_NULL && ch != KEY_TIMEOUT)
260                            {
261                                    BBS_last_access_tm = time(NULL);
262                            }
263    
264                            switch (ch)
265                            {
266                            case KEY_NULL: // broken pipe
267                                    log_error("KEY_NULL\n");
268                                    show_top10 = 0;
269                                    return 0;
270                            case KEY_TIMEOUT:
271                                    if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
272                                    {
273                                            log_error("User input timeout\n");
274                                            show_top10 = 0;
275                                            return 0;
276                                    }
277                                    continue;
278                            case CR:
279                            default:
280                                    switch (menu_control(&top10_menu, ch))
281                                    {
282                                    case EXITMENU:
283                                            ch = EXITMENU;
284                                            break;
285                                    case REDRAW:
286                                            clearscr();
287                                            show_bottom("");
288                                            display_menu(&top10_menu);
289                                            break;
290                                    case NOREDRAW:
291                                    case UNKNOWN_CMD:
292                                    default:
293                                            break;
294                                    }
295                            }
296    
297                            if (ch == EXITMENU)
298                            {
299                                    break;
300                            }
301                    }
302            }
303    
304            show_top10 = 0;
305            return REDRAW;
306    }
307    
308    int locate_article(void *param)
309    {
310            char buf[MAX_MENUITEM_NAME_LENGTH];
311            char *sname, *aid, *saveptr;
312    
313            strncpy(buf, param, sizeof(buf) - 1);
314            buf[sizeof(buf) - 1] = '\0';
315    
316            sname = strtok_r(buf, "|", &saveptr);
317            aid = strtok_r(NULL, "|", &saveptr);
318    
319            if (sname == NULL || aid == NULL)
320            {
321                    log_error("top10_locate(%s) error: invalid parameter\n", param);
322                    return NOREDRAW;
323            }
324    
325            section_list_display(sname, atoi(aid));
326    
327            return REDRAW;
328    }
329    
330    int favor_topic(void *param)
331    {
332            if (article_favor_display(&BBS_article_favor) < 0)
333            {
334                    log_error("article_favor_display() error\n");
335            }
336    
337            return REDRAW;
338  }  }


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

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