| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
menu_proc.c - description |
/* |
| 3 |
------------------- |
* menu_proc |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - handler functions of menu commands |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* This program is free software; you can redistribute it and/or modify * |
|
|
* it under the terms of the GNU General Public License as published by * |
|
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#include "article_cache.h" |
#include "article_cache.h" |
| 10 |
#include "article_favor_display.h" |
#include "article_favor_display.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_list_display.h" |
| 22 |
#include "user_priv.h" |
#include "user_priv.h" |
| 23 |
#include <dlfcn.h> |
#include <dlfcn.h> |
| 24 |
#include <errno.h> |
#include <errno.h> |
| 36 |
return REDRAW; |
return REDRAW; |
| 37 |
} |
} |
| 38 |
|
|
| 39 |
|
typedef union exec_handler_t |
| 40 |
|
{ |
| 41 |
|
void *p; |
| 42 |
|
int (*handler)(); |
| 43 |
|
} exec_handler; |
| 44 |
|
|
| 45 |
int exec_mbem(void *param) |
int exec_mbem(void *param) |
| 46 |
{ |
{ |
| 47 |
void *hdll; |
void *hdll; |
| 48 |
int (*func)(); |
exec_handler func; |
| 49 |
char *c, *s; |
char *c, *s; |
| 50 |
char buf[FILE_PATH_LEN]; |
char buf[FILE_PATH_LEN]; |
| 51 |
|
|
| 68 |
{ |
{ |
| 69 |
char *error; |
char *error; |
| 70 |
|
|
| 71 |
if ((func = dlsym(hdll, c ? c : "mod_main")) != NULL) |
if ((func.p = dlsym(hdll, c ? c : "mod_main")) != NULL) |
| 72 |
func(); |
{ |
| 73 |
|
func.handler(); |
| 74 |
|
} |
| 75 |
else if ((error = dlerror()) != NULL) |
else if ((error = dlerror()) != NULL) |
| 76 |
{ |
{ |
| 77 |
clearscr(); |
clearscr(); |
| 269 |
show_top10 = 0; |
show_top10 = 0; |
| 270 |
return 0; |
return 0; |
| 271 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 272 |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
| 273 |
{ |
{ |
| 274 |
log_error("User input timeout\n"); |
log_error("User input timeout\n"); |
| 275 |
show_top10 = 0; |
show_top10 = 0; |
| 336 |
} |
} |
| 337 |
|
|
| 338 |
return REDRAW; |
return REDRAW; |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
int list_user(void *param) |
| 342 |
|
{ |
| 343 |
|
if (user_list_display(0) < 0) |
| 344 |
|
{ |
| 345 |
|
log_error("user_list_display(all_user) error\n"); |
| 346 |
|
} |
| 347 |
|
|
| 348 |
|
return REDRAW; |
| 349 |
|
} |
| 350 |
|
|
| 351 |
|
int list_online_user(void *param) |
| 352 |
|
{ |
| 353 |
|
if (user_list_display(1) < 0) |
| 354 |
|
{ |
| 355 |
|
log_error("user_list_display(online_user) error\n"); |
| 356 |
|
} |
| 357 |
|
|
| 358 |
|
return REDRAW; |
| 359 |
} |
} |