/[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.61 by sysadm, Thu Dec 18 10:43:48 2025 UTC Revision 1.63 by sysadm, Sat Jan 3 10:27:14 2026 UTC
# Line 3  Line 3 
3   * menu_proc   * menu_proc
4   *   - handler functions of menu commands   *   - handler functions of menu commands
5   *   *
6   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2026  Leaflet <leaflet@leafok.com>
7   */   */
8    
9  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
# Line 159  int reload_bbs_conf(void *param) Line 159  int reload_bbs_conf(void *param)
159    
160          if (kill(getppid(), SIGHUP) < 0)          if (kill(getppid(), SIGHUP) < 0)
161          {          {
162                  log_error("Send SIGHUP signal failed (%d)\n", errno);                  log_error("Send SIGHUP signal failed (%d)", errno);
163    
164                  prints("发送指令失败\r\n");                  prints("发送指令失败\r\n");
165          }          }
# Line 182  int shutdown_bbs(void *param) Line 182  int shutdown_bbs(void *param)
182    
183          if (toupper(buf[0]) == 'Y')          if (toupper(buf[0]) == 'Y')
184          {          {
185                  log_common("Notify main process to exit by [%s]\n", BBS_username);                  log_common("Notify main process to exit by [%s]", BBS_username);
186    
187                  if (kill(getppid(), SIGTERM) < 0)                  if (kill(getppid(), SIGTERM) < 0)
188                  {                  {
189                          log_error("Send SIGTERM signal failed (%d)\n", errno);                          log_error("Send SIGTERM signal failed (%d)", errno);
190                  }                  }
191          }          }
192    
# Line 227  int view_ex_article(void *param) Line 227  int view_ex_article(void *param)
227          p_article = article_block_find_by_aid(aid);          p_article = article_block_find_by_aid(aid);
228          if (p_article == NULL)          if (p_article == NULL)
229          {          {
230                  log_error("article_block_find_by_aid(%d) error\n", aid);                  log_error("article_block_find_by_aid(%d) error", aid);
231                  return NOREDRAW;                  return NOREDRAW;
232          }          }
233    
234          if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0)          if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0)
235          {          {
236                  log_error("article_cache_load(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);                  log_error("article_cache_load(aid=%d, cid=%d) error", p_article->aid, p_article->cid);
237                  return NOREDRAW;                  return NOREDRAW;
238          }          }
239    
240          if (user_online_update("VIEW_ARTICLE") < 0)          if (user_online_update("VIEW_ARTICLE") < 0)
241          {          {
242                  log_error("user_online_update(VIEW_ARTICLE) error\n");                  log_error("user_online_update(VIEW_ARTICLE) error");
243          }          }
244    
245          ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0,          ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0,
# Line 247  int view_ex_article(void *param) Line 247  int view_ex_article(void *param)
247    
248          if (article_cache_unload(&cache) < 0)          if (article_cache_unload(&cache) < 0)
249          {          {
250                  log_error("article_cache_unload(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid);                  log_error("article_cache_unload(aid=%d, cid=%d) error", p_article->aid, p_article->cid);
251          }          }
252    
253          // Update article_view_log          // Update article_view_log
254          if (article_view_log_set_viewed(p_article->aid, &BBS_article_view_log) < 0)          if (article_view_log_set_viewed(p_article->aid, &BBS_article_view_log) < 0)
255          {          {
256                  log_error("article_view_log_set_viewed(aid=%d) error\n", p_article->aid);                  log_error("article_view_log_set_viewed(aid=%d) error", p_article->aid);
257          }          }
258    
259          return REDRAW;          return REDRAW;
# Line 266  int list_ex_section(void *param) Line 266  int list_ex_section(void *param)
266          p_section = section_list_find_by_name(param);          p_section = section_list_find_by_name(param);
267          if (p_section == NULL)          if (p_section == NULL)
268          {          {
269                  log_error("Section %s not found\n", (const char *)param);                  log_error("Section %s not found", (const char *)param);
270                  return -1;                  return -1;
271          }          }
272    
273          if (section_list_ex_dir_display(p_section) < 0)          if (section_list_ex_dir_display(p_section) < 0)
274          {          {
275                  log_error("section_list_ex_dir_display(sid=%d) error\n", p_section->sid);                  log_error("section_list_ex_dir_display(sid=%d) error", p_section->sid);
276          }          }
277    
278          return REDRAW;          return REDRAW;
# Line 308  int show_top10_menu(void *param) Line 308  int show_top10_menu(void *param)
308    
309                          if (user_online_update("TOP10_MENU") < 0)                          if (user_online_update("TOP10_MENU") < 0)
310                          {                          {
311                                  log_error("user_online_update(TOP10_MENU) error\n");                                  log_error("user_online_update(TOP10_MENU) error");
312                          }                          }
313    
314                          switch (ch)                          switch (ch)
315                          {                          {
316                          case KEY_NULL: // broken pipe                          case KEY_NULL: // broken pipe
317                                  log_debug("KEY_NULL\n");                                  log_debug("KEY_NULL");
318                                  loop = 0;                                  loop = 0;
319                                  break;                                  break;
320                          case KEY_TIMEOUT:                          case KEY_TIMEOUT:
321                                  if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)                                  if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time)
322                                  {                                  {
323                                          log_debug("User input timeout\n");                                          log_debug("User input timeout");
324                                          loop = 0;                                          loop = 0;
325                                          break;                                          break;
326                                  }                                  }
# Line 363  int locate_article(void *param) Line 363  int locate_article(void *param)
363    
364          if (sname == NULL || aid == NULL)          if (sname == NULL || aid == NULL)
365          {          {
366                  log_error("top10_locate(%s) error: invalid parameter\n", param);                  log_error("top10_locate(%s) error: invalid parameter", param);
367                  return NOREDRAW;                  return NOREDRAW;
368          }          }
369    
# Line 376  int favor_topic(void *param) Line 376  int favor_topic(void *param)
376  {  {
377          if (article_favor_display(&BBS_article_favor) < 0)          if (article_favor_display(&BBS_article_favor) < 0)
378          {          {
379                  log_error("article_favor_display() error\n");                  log_error("article_favor_display() error");
380          }          }
381    
382          return REDRAW;          return REDRAW;
# Line 386  int list_user(void *param) Line 386  int list_user(void *param)
386  {  {
387          if (user_list_display(0) < 0)          if (user_list_display(0) < 0)
388          {          {
389                  log_error("user_list_display(all_user) error\n");                  log_error("user_list_display(all_user) error");
390          }          }
391    
392          return REDRAW;          return REDRAW;
# Line 396  int list_online_user(void *param) Line 396  int list_online_user(void *param)
396  {  {
397          if (user_list_display(1) < 0)          if (user_list_display(1) < 0)
398          {          {
399                  log_error("user_list_display(online_user) error\n");                  log_error("user_list_display(online_user) error");
400          }          }
401    
402          return REDRAW;          return REDRAW;
# Line 406  int edit_intro(void *param) Line 406  int edit_intro(void *param)
406  {  {
407          if (user_intro_edit(BBS_priv.uid) < 0)          if (user_intro_edit(BBS_priv.uid) < 0)
408          {          {
409                  log_error("user_intro_edit(%d) error\n", BBS_priv.uid);                  log_error("user_intro_edit(%d) error", BBS_priv.uid);
410          }          }
411    
412          return REDRAW;          return REDRAW;
# Line 416  int edit_sign(void *param) Line 416  int edit_sign(void *param)
416  {  {
417          if (user_sign_edit(BBS_priv.uid) < 0)          if (user_sign_edit(BBS_priv.uid) < 0)
418          {          {
419                  log_error("user_sign_edit(%d) error\n", BBS_priv.uid);                  log_error("user_sign_edit(%d) error", BBS_priv.uid);
420          }          }
421    
422          return REDRAW;          return REDRAW;


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

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