summaryrefslogtreecommitdiffstats
path: root/microbbs.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2014-12-09 10:31:37 +0900
committerFreeArtMan <dos21h@gmail.com>2014-12-09 10:31:37 +0900
commita57c6bed8f6ab7d0f4355190c0cff7cd913da6a0 (patch)
treec8b85b9de364cb63678d05625bdff6a2cf12ecda /microbbs.c
parentdc4bbe5366d6c733f9f77b7c9fee0cbba3e0d92b (diff)
downloadmicrobbs-a57c6bed8f6ab7d0f4355190c0cff7cd913da6a0.tar.gz
microbbs-a57c6bed8f6ab7d0f4355190c0cff7cd913da6a0.zip
New planned functionality. Menuconfig support. Simple captcha.
Diffstat (limited to 'microbbs.c')
-rw-r--r--microbbs.c108
1 files changed, 107 insertions, 1 deletions
diff --git a/microbbs.c b/microbbs.c
index 6a6c098..8387cb8 100644
--- a/microbbs.c
+++ b/microbbs.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "kconfig.h"
#include "logs.h"
#include "motd.h"
#include "libterm/term.h"
@@ -16,36 +17,139 @@ int main( int argc, char **argv )
term_init_data( &ts );
//printf("%d %d\n", ts.term_col, ts.term_row);
+ //lunch captcha and try to detect if its random bot
+#ifdef CONFIG_CAPTCHA
+ if ( captcha_test1() != 1)
+ return 1;
+#endif
+
//write to log that some user have accesed bbs
+ //too much fake stuff comes to log
//bbs_log( NULL ); //write to default place
+#ifdef CONFIG_MOTD
bbs_login_motd( &ts, "art/motd.txt" );
print_build_info();
+#endif
+
while ( strncmp( str, "q", 1 ) && strncmp( str, "Q", 1 ) )
{
- printf("(M)otd (Q)uit (S)ysinfo (A)rticles: ");
+ #ifdef CONFIG_MOTD
+ printf("(M)otd ");
+ #endif
+
+ #ifdef CONFIG_ARTICLES
+ printf("(A)rticles ");
+ #endif
+
+ #ifdef CONFIG_DOORGAMES
+ printf("(D)oor games ");
+ #endif
+
+ #ifdef CONFIG_TWIT
+ printf("(T)wit ");
+ #endif
+
+ #ifdef CONFIG_BOARD
+ printf("(B)oard ");
+ #endif
+
+ #ifdef CONFIG_LOGIN
+ printf("(L)ogin ");
+ #endif
+
+ #ifdef CONFIG_TODO
+ printf("T(o)do ");
+ #endif
+ printf("(Q)uit (S)ysinfo Mesa(G)es: ");
ret_len = getline( &str, &str_size, stdin );
if ( ret_len > 0)
{
switch ( str[0] )
{
+ //------------------------------------------------------------------
+ #ifdef CONFIG_MOTD
case 'm':
case 'M':
{
bbs_login_motd( &ts, "art/motd.txt" );
}
break;
+ #endif
case 's':
case 'S':
{
bbs_sysinfo( &ts );
}
break;
+
+ //------------------------------------------------------------------
+ #ifdef CONFIG_ARTICLES
case 'a':
case 'A':
{
bbs_article_list( &ts, "./article/" );
}
break;
+ #endif
+
+ //------------------------------------------------------------------
+ #ifdef CONFIG_TWIT
+ case 't':
+ case 'T':
+ {
+ printf("Twitter like\n");
+ }
+ break;
+ #endif
+
+ //------------------------------------------------------------------
+ #ifdef CONFIG_DOORGAMES
+ case 'd':
+ case 'D':
+ {
+ printf("Door games\n");
+ }
+ break;
+ #endif
+
+ case 'g':
+ case 'G':
+ {
+ printf("Messages\n");
+ }
+ break;
+
+ //------------------------------------------------------------------
+ #ifdef CONFIG_BOARD
+ case 'b':
+ case 'B':
+ {
+ printf("Board\n");
+ }
+ break;
+ #endif
+
+
+ //------------------------------------------------------------------
+ #ifdef CONFIG_LOGIN
+ case 'l':
+ case 'L':
+ {
+ printf("Login?\n");
+ }
+ break;
+ #endif
+
+ //------------------------------------------------------------------
+ #ifdef CONFIG_TODO
+ case 'o':
+ case 'O':
+ {
+ printf("Todo list\n");
+ }
+ break;
+ #endif
+
case 'q':
case 'Q':
bbs_log_quit( NULL );
@@ -55,6 +159,8 @@ int main( int argc, char **argv )
}
}
}
+#ifdef CONFIG_MOTD
bbs_quit_motd( &ts, "art/quit.txt" );
+#endif
return 0;
}