| 28 |
#include "bbs_cmd.h" |
#include "bbs_cmd.h" |
| 29 |
#include "section_list.h" |
#include "section_list.h" |
| 30 |
#include "trie_dict.h" |
#include "trie_dict.h" |
| 31 |
|
#include "editor.h" |
| 32 |
#include <unistd.h> |
#include <unistd.h> |
| 33 |
#include <time.h> |
#include <time.h> |
| 34 |
#include <string.h> |
#include <string.h> |
| 37 |
int bbs_info() |
int bbs_info() |
| 38 |
{ |
{ |
| 39 |
prints("»¶Ó¹âÁÙ \033[1;33m%s \033[32m[%s] \033[37m( %s )\r\n", |
prints("»¶Ó¹âÁÙ \033[1;33m%s \033[32m[%s] \033[37m( %s )\r\n", |
| 40 |
BBS_name, BBS_server, APP_NAME_VER); |
BBS_name, BBS_server, APP_INFO); |
| 41 |
|
|
| 42 |
return iflush(); |
return iflush(); |
| 43 |
} |
} |
| 197 |
int ch; |
int ch; |
| 198 |
time_t t_last_action; |
time_t t_last_action; |
| 199 |
|
|
| 200 |
BBS_last_access_tm = t_last_action = time(0); |
BBS_last_access_tm = t_last_action = time(NULL); |
| 201 |
|
|
| 202 |
clearscr(); |
clearscr(); |
| 203 |
|
|
| 211 |
{ |
{ |
| 212 |
ch = igetch(100); |
ch = igetch(100); |
| 213 |
|
|
| 214 |
if (p_bbs_menu->choose_step == 0 && time(0) - t_last_action >= 10) |
if (p_bbs_menu->choose_step == 0 && time(NULL) - t_last_action >= 10) |
| 215 |
{ |
{ |
| 216 |
t_last_action = time(0); |
t_last_action = time(NULL); |
| 217 |
|
|
| 218 |
show_active_board(); |
show_active_board(); |
| 219 |
show_bottom(""); |
show_bottom(""); |
| 221 |
iflush(); |
iflush(); |
| 222 |
} |
} |
| 223 |
|
|
| 224 |
|
if (user_online_update("MENU") < 0) |
| 225 |
|
{ |
| 226 |
|
log_error("user_online_update(MENU) error\n"); |
| 227 |
|
} |
| 228 |
|
|
| 229 |
switch (ch) |
switch (ch) |
| 230 |
{ |
{ |
| 231 |
case KEY_NULL: // broken pipe |
case KEY_NULL: // broken pipe |
| 232 |
return 0; |
return 0; |
| 233 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 234 |
if (time(0) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time(NULL) - BBS_last_access_tm >= MAX_DELAY_TIME) |
| 235 |
{ |
{ |
| 236 |
return 0; |
return 0; |
| 237 |
} |
} |
| 244 |
case EXITBBS: |
case EXITBBS: |
| 245 |
return 0; |
return 0; |
| 246 |
case REDRAW: |
case REDRAW: |
| 247 |
t_last_action = time(0); |
t_last_action = time(NULL); |
| 248 |
clearscr(); |
clearscr(); |
| 249 |
show_top("", BBS_name, ""); |
show_top("", BBS_name, ""); |
| 250 |
show_active_board(); |
show_active_board(); |
| 259 |
iflush(); |
iflush(); |
| 260 |
} |
} |
| 261 |
|
|
| 262 |
BBS_last_access_tm = time(0); |
BBS_last_access_tm = time(NULL); |
| 263 |
} |
} |
| 264 |
|
|
| 265 |
return 0; |
return 0; |
| 320 |
goto cleanup; |
goto cleanup; |
| 321 |
} |
} |
| 322 |
|
|
| 323 |
|
// Init editor memory pool |
| 324 |
|
if (editor_memory_pool_init() < 0) |
| 325 |
|
{ |
| 326 |
|
log_error("editor_memory_pool_init() error\n"); |
| 327 |
|
goto cleanup; |
| 328 |
|
} |
| 329 |
|
|
| 330 |
clearscr(); |
clearscr(); |
| 331 |
|
|
| 332 |
// BBS Top 10 |
// BBS Top 10 |
| 345 |
} |
} |
| 346 |
|
|
| 347 |
cleanup: |
cleanup: |
| 348 |
|
// Cleanup editor memory pool |
| 349 |
|
editor_memory_pool_cleanup(); |
| 350 |
|
|
| 351 |
// Unload article view log |
// Unload article view log |
| 352 |
article_view_log_unload(&BBS_article_view_log); |
article_view_log_unload(&BBS_article_view_log); |
| 353 |
|
|