/[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.30 by sysadm, Wed Jul 2 04:17:33 2025 UTC Revision 1.38 by sysadm, Thu Oct 16 11:26:16 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 37  Line 38 
38    
39  int list_section(void *param)  int list_section(void *param)
40  {  {
41          section_list_display(param);          section_list_display(param, 0);
42    
43          return REDRAW;          return REDRAW;
44  }  }
# Line 141  int shutdown_bbs(void *param) Line 142  int shutdown_bbs(void *param)
142          return REDRAW;          return REDRAW;
143  }  }
144    
145  int favour_section_filter(void *param)  int favor_section_filter(void *param)
146  {  {
147          MENU_ITEM *p_menu_item = param;          MENU_ITEM *p_menu_item = param;
148    
# Line 224  int list_ex_section(void *param) Line 225  int list_ex_section(void *param)
225          }          }
226    
227          return REDRAW;          return REDRAW;
228    }
229    
230    int show_top10_menu(void *param)
231    {
232            static int show_top10 = 0;
233            int ch = 0;
234    
235            if (show_top10)
236            {
237                    return NOREDRAW;
238            }
239            show_top10 = 1;
240    
241            clearscr();
242            show_top("", BBS_name, "");
243            show_bottom("");
244    
245            if (display_menu(&top10_menu) == 0)
246            {
247                    while (!SYS_server_exit)
248                    {
249                            iflush();
250                            ch = igetch(100);
251    
252                            if (ch != KEY_NULL && ch != KEY_TIMEOUT)
253                            {
254                                    BBS_last_access_tm = time(NULL);
255                            }
256    
257                            switch (ch)
258                            {
259                            case KEY_NULL: // broken pipe
260                                    log_error("KEY_NULL\n");
261                                    show_top10 = 0;
262                                    return 0;
263                            case KEY_TIMEOUT:
264                                    if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
265                                    {
266                                            log_error("User input timeout\n");
267                                            show_top10 = 0;
268                                            return 0;
269                                    }
270                                    continue;
271                            case CR:
272                                    igetch_reset();
273                            default:
274                                    switch (menu_control(&top10_menu, ch))
275                                    {
276                                    case EXITMENU:
277                                            ch = EXITMENU;
278                                            break;
279                                    case REDRAW:
280                                            clearscr();
281                                            show_bottom("");
282                                            display_menu(&top10_menu);
283                                            break;
284                                    case NOREDRAW:
285                                    case UNKNOWN_CMD:
286                                    default:
287                                            break;
288                                    }
289                            }
290    
291                            if (ch == EXITMENU)
292                            {
293                                    break;
294                            }
295                    }
296            }
297    
298            show_top10 = 0;
299            return REDRAW;
300    }
301    
302    int locate_article(void *param)
303    {
304            char buf[MAX_MENUITEM_NAME_LENGTH];
305            char *sname, *aid, *saveptr;
306    
307            strncpy(buf, param, sizeof(buf) - 1);
308            buf[sizeof(buf) - 1] = '\0';
309    
310            sname = strtok_r(buf, "|", &saveptr);
311            aid = strtok_r(NULL, "|", &saveptr);
312    
313            if (sname == NULL || aid == NULL)
314            {
315                    log_error("top10_locate(%s) error: invalid parameter\n", param);
316                    return NOREDRAW;
317            }
318    
319            section_list_display(sname, atoi(aid));
320    
321            return REDRAW;
322    }
323    
324    int favor_topic(void *param)
325    {
326            if (article_favor_display(&BBS_article_favor) < 0)
327            {
328                    log_error("article_favor_display() error\n");
329            }
330    
331            return REDRAW;
332  }  }


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

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