| 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" |
| 26 |
#include "menu.h" |
#include "menu.h" |
| 27 |
#include "section_list_display.h" |
#include "section_list_display.h" |
| 28 |
#include "screen.h" |
#include "screen.h" |
| 29 |
|
#include "user_list_display.h" |
| 30 |
#include "user_priv.h" |
#include "user_priv.h" |
| 31 |
#include <dlfcn.h> |
#include <dlfcn.h> |
| 32 |
#include <errno.h> |
#include <errno.h> |
| 44 |
return REDRAW; |
return REDRAW; |
| 45 |
} |
} |
| 46 |
|
|
| 47 |
|
typedef union exec_handler_t{ |
| 48 |
|
void *p; |
| 49 |
|
int (*handler)(); |
| 50 |
|
} exec_handler; |
| 51 |
|
|
| 52 |
int exec_mbem(void *param) |
int exec_mbem(void *param) |
| 53 |
{ |
{ |
| 54 |
void *hdll; |
void *hdll; |
| 55 |
int (*func)(); |
exec_handler func; |
| 56 |
char *c, *s; |
char *c, *s; |
| 57 |
char buf[FILE_PATH_LEN]; |
char buf[FILE_PATH_LEN]; |
| 58 |
|
|
| 75 |
{ |
{ |
| 76 |
char *error; |
char *error; |
| 77 |
|
|
| 78 |
if ((func = dlsym(hdll, c ? c : "mod_main")) != NULL) |
if ((func.p = dlsym(hdll, c ? c : "mod_main")) != NULL) |
| 79 |
func(); |
{ |
| 80 |
|
func.handler(); |
| 81 |
|
} |
| 82 |
else if ((error = dlerror()) != NULL) |
else if ((error = dlerror()) != NULL) |
| 83 |
{ |
{ |
| 84 |
clearscr(); |
clearscr(); |
| 118 |
return REDRAW; |
return REDRAW; |
| 119 |
} |
} |
| 120 |
|
|
| 121 |
|
int version(void *param) |
| 122 |
|
{ |
| 123 |
|
display_file(DATA_VERSION, 1); |
| 124 |
|
|
| 125 |
|
return REDRAW; |
| 126 |
|
} |
| 127 |
|
|
| 128 |
int reload_bbs_conf(void *param) |
int reload_bbs_conf(void *param) |
| 129 |
{ |
{ |
| 130 |
clearscr(); |
clearscr(); |
| 227 |
{ |
{ |
| 228 |
SECTION_LIST *p_section; |
SECTION_LIST *p_section; |
| 229 |
|
|
| 230 |
p_section = section_list_find_by_name(param, NULL); |
p_section = section_list_find_by_name(param); |
| 231 |
if (p_section == NULL) |
if (p_section == NULL) |
| 232 |
{ |
{ |
| 233 |
log_error("Section %s not found\n", (const char *)param); |
log_error("Section %s not found\n", (const char *)param); |
| 252 |
return NOREDRAW; |
return NOREDRAW; |
| 253 |
} |
} |
| 254 |
show_top10 = 1; |
show_top10 = 1; |
| 255 |
|
|
| 256 |
clearscr(); |
clearscr(); |
| 257 |
show_top("", BBS_name, ""); |
show_top("", BBS_name, ""); |
| 258 |
show_bottom(""); |
show_bottom(""); |
| 263 |
{ |
{ |
| 264 |
iflush(); |
iflush(); |
| 265 |
ch = igetch(100); |
ch = igetch(100); |
| 266 |
|
|
| 267 |
|
if (ch != KEY_NULL && ch != KEY_TIMEOUT) |
| 268 |
|
{ |
| 269 |
|
BBS_last_access_tm = time(NULL); |
| 270 |
|
} |
| 271 |
|
|
| 272 |
switch (ch) |
switch (ch) |
| 273 |
{ |
{ |
| 274 |
case KEY_NULL: // broken pipe |
case KEY_NULL: // broken pipe |
| 275 |
|
log_error("KEY_NULL\n"); |
| 276 |
show_top10 = 0; |
show_top10 = 0; |
| 277 |
return 0; |
return 0; |
| 278 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 279 |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
| 280 |
{ |
{ |
| 281 |
|
log_error("User input timeout\n"); |
| 282 |
show_top10 = 0; |
show_top10 = 0; |
| 283 |
return 0; |
return 0; |
| 284 |
} |
} |
| 285 |
continue; |
continue; |
| 286 |
case CR: |
case CR: |
|
igetch_reset(); |
|
| 287 |
default: |
default: |
| 288 |
switch (menu_control(&top10_menu, ch)) |
switch (menu_control(&top10_menu, ch)) |
| 289 |
{ |
{ |
| 302 |
} |
} |
| 303 |
} |
} |
| 304 |
|
|
|
BBS_last_access_tm = time(NULL); |
|
|
|
|
| 305 |
if (ch == EXITMENU) |
if (ch == EXITMENU) |
| 306 |
{ |
{ |
| 307 |
break; |
break; |
| 308 |
} |
} |
| 309 |
} |
} |
| 310 |
} |
} |
| 311 |
|
|
| 312 |
show_top10 = 0; |
show_top10 = 0; |
| 313 |
return REDRAW; |
return REDRAW; |
| 314 |
} |
} |
| 337 |
|
|
| 338 |
int favor_topic(void *param) |
int favor_topic(void *param) |
| 339 |
{ |
{ |
| 340 |
clearscr(); |
if (article_favor_display(&BBS_article_favor) < 0) |
| 341 |
prints("此功能尚未实现"); |
{ |
| 342 |
press_any_key(); |
log_error("article_favor_display() error\n"); |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
return REDRAW; |
| 346 |
|
} |
| 347 |
|
|
| 348 |
|
int list_user(void *param) |
| 349 |
|
{ |
| 350 |
|
if (user_list_display(0) < 0) |
| 351 |
|
{ |
| 352 |
|
log_error("user_list_display(all_user) error\n"); |
| 353 |
|
} |
| 354 |
|
|
| 355 |
|
return REDRAW; |
| 356 |
|
} |
| 357 |
|
|
| 358 |
|
int list_online_user(void *param) |
| 359 |
|
{ |
| 360 |
|
if (user_list_display(1) < 0) |
| 361 |
|
{ |
| 362 |
|
log_error("user_list_display(online_user) error\n"); |
| 363 |
|
} |
| 364 |
|
|
| 365 |
return REDRAW; |
return REDRAW; |
| 366 |
} |
} |