/[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.33 by sysadm, Mon Oct 13 05:39:45 2025 UTC Revision 1.37 by sysadm, Tue Oct 14 06:27:44 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 211  int list_ex_section(void *param) Line 212  int list_ex_section(void *param)
212  {  {
213          SECTION_LIST *p_section;          SECTION_LIST *p_section;
214    
215          p_section = section_list_find_by_name(param, NULL);          p_section = section_list_find_by_name(param);
216          if (p_section == NULL)          if (p_section == NULL)
217          {          {
218                  log_error("Section %s not found\n", (const char *)param);                  log_error("Section %s not found\n", (const char *)param);
# Line 226  int list_ex_section(void *param) Line 227  int list_ex_section(void *param)
227          return REDRAW;          return REDRAW;
228  }  }
229    
230  int top10_menu(void *param)  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                            switch (ch)
252                            {
253                            case KEY_NULL: // broken pipe
254                                    show_top10 = 0;
255                                    return 0;
256                            case KEY_TIMEOUT:
257                                    if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME)
258                                    {
259                                            show_top10 = 0;
260                                            return 0;
261                                    }
262                                    continue;
263                            case CR:
264                                    igetch_reset();
265                            default:
266                                    switch (menu_control(&top10_menu, ch))
267                                    {
268                                    case EXITMENU:
269                                            ch = EXITMENU;
270                                            break;
271                                    case REDRAW:
272                                            clearscr();
273                                            show_bottom("");
274                                            display_menu(&top10_menu);
275                                            break;
276                                    case NOREDRAW:
277                                    case UNKNOWN_CMD:
278                                    default:
279                                            break;
280                                    }
281                            }
282    
283                            BBS_last_access_tm = time(NULL);
284    
285                            if (ch == EXITMENU)
286                            {
287                                    break;
288                            }
289                    }
290            }
291            
292            show_top10 = 0;
293          return REDRAW;          return REDRAW;
294  }  }
295    
296  int locate_article(void *param)  int locate_article(void *param)
297  {  {
298            char buf[MAX_MENUITEM_NAME_LENGTH];
299          char *sname, *aid, *saveptr;          char *sname, *aid, *saveptr;
300    
301          sname = strtok_r(param, " ", &saveptr);          strncpy(buf, param, sizeof(buf) - 1);
302          aid = strtok_r(NULL, " ", &saveptr);          buf[sizeof(buf) - 1] = '\0';
303    
304            sname = strtok_r(buf, "|", &saveptr);
305            aid = strtok_r(NULL, "|", &saveptr);
306    
307          if (sname == NULL || aid == NULL)          if (sname == NULL || aid == NULL)
308          {          {
309                  log_error("top10_locate() error: invalid parameter\n", (const char *)param);                  log_error("top10_locate(%s) error: invalid parameter\n", param);
310                  return NOREDRAW;                  return NOREDRAW;
311          }          }
312    
# Line 251  int locate_article(void *param) Line 317  int locate_article(void *param)
317    
318  int favor_topic(void *param)  int favor_topic(void *param)
319  {  {
320          clearscr();          if (article_favor_display(&BBS_article_favor) < 0)
321          prints("此功能尚未实现");          {
322          press_any_key();                  log_error("article_favor_display() error\n");
323            }
324    
325          return REDRAW;          return REDRAW;
326  }  }


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

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