| 3 |
* menu_proc |
* menu_proc |
| 4 |
* - handler functions of menu commands |
* - handler functions of menu commands |
| 5 |
* |
* |
| 6 |
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com> |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
#include "article_cache.h" |
#include "article_cache.h" |
| 18 |
#include "menu.h" |
#include "menu.h" |
| 19 |
#include "section_list_display.h" |
#include "section_list_display.h" |
| 20 |
#include "screen.h" |
#include "screen.h" |
| 21 |
|
#include "user_info_update.h" |
| 22 |
#include "user_list_display.h" |
#include "user_list_display.h" |
| 23 |
#include "user_priv.h" |
#include "user_priv.h" |
| 24 |
|
#include <ctype.h> |
| 25 |
#include <dlfcn.h> |
#include <dlfcn.h> |
| 26 |
#include <errno.h> |
#include <errno.h> |
| 27 |
#include <signal.h> |
#include <signal.h> |
| 142 |
|
|
| 143 |
int shutdown_bbs(void *param) |
int shutdown_bbs(void *param) |
| 144 |
{ |
{ |
| 145 |
log_common("Notify main process to exit\n"); |
char buf[2] = "N"; |
| 146 |
|
|
| 147 |
if (kill(getppid(), SIGTERM) < 0) |
clearscr(); |
| 148 |
|
get_data(1, 1, "真的要关闭系统吗[y/N]? ", buf, sizeof(buf), 1); |
| 149 |
|
|
| 150 |
|
if (toupper(buf[0]) == 'Y') |
| 151 |
{ |
{ |
| 152 |
log_error("Send SIGTERM signal failed (%d)\n", errno); |
log_common("Notify main process to exit by [%s]\n", BBS_username); |
| 153 |
|
|
| 154 |
|
if (kill(getppid(), SIGTERM) < 0) |
| 155 |
|
{ |
| 156 |
|
log_error("Send SIGTERM signal failed (%d)\n", errno); |
| 157 |
|
} |
| 158 |
} |
} |
| 159 |
|
|
| 160 |
return REDRAW; |
return REDRAW; |
| 279 |
show_top10 = 0; |
show_top10 = 0; |
| 280 |
return 0; |
return 0; |
| 281 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 282 |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
| 283 |
{ |
{ |
| 284 |
log_error("User input timeout\n"); |
log_error("User input timeout\n"); |
| 285 |
show_top10 = 0; |
show_top10 = 0; |
| 366 |
} |
} |
| 367 |
|
|
| 368 |
return REDRAW; |
return REDRAW; |
| 369 |
|
} |
| 370 |
|
|
| 371 |
|
int edit_intro(void *param) |
| 372 |
|
{ |
| 373 |
|
if (user_intro_edit(BBS_priv.uid) < 0) |
| 374 |
|
{ |
| 375 |
|
log_error("user_intro_edit(%d) error\n", BBS_priv.uid); |
| 376 |
|
} |
| 377 |
|
|
| 378 |
|
return REDRAW; |
| 379 |
} |
} |