diff options
Diffstat (limited to 'microbbs.c')
-rw-r--r-- | microbbs.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1,16 +1,22 @@ +#define __MICROBBS_MAIN + #include <stdio.h> #include <stdlib.h> + #include "kconfig.h" #include "logs.h" #include "motd.h" #include "sysinfo.h" #include "articles.h" +#include "user.h" + #include "libterm/term.h" #include "libterm/term_io.h" #include "ini.h" + int main( int argc, char **argv ) { int quit_main_menu = 0; @@ -23,6 +29,9 @@ int main( int argc, char **argv ) term_set_raw_mode( &ts ); term_clr_scr( &ts ); + //init global variable of bbs user + bbs_user_init( &g_user ); + //lunch captcha and try to detect if its random bot #ifdef CONFIG_CAPTCHA if ( captcha_test1( ts ) != 1) @@ -50,6 +59,11 @@ int main( int argc, char **argv ) term_cur_set_r( &ts, 0 ); term_cur_set_c( &ts, 0 ); + #ifdef CONFIG_LOGIN + if ( bbs_user_get_status( &g_user ) == BBS_USER_LOGEDIN ) + printf("[LOGEDIN] "); + #endif + #ifdef CONFIG_MOTD printf("(M)otd "); #endif @@ -71,7 +85,8 @@ int main( int argc, char **argv ) #endif #ifdef CONFIG_LOGIN - printf("(L)ogin "); + if ( bbs_user_get_status( &g_user ) != BBS_USER_LOGEDIN ) + printf("(L)ogin "); #endif #ifdef CONFIG_TODO @@ -171,7 +186,7 @@ int main( int argc, char **argv ) case 'l': case 'L': { - printf("Login?\n"); + bbs_login( &ts ); } break; #endif |