summaryrefslogblamecommitdiffstats
path: root/user.h
blob: 3ac290a1993cdf0752caba60eb81c9b126e60cdf (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                         

                 







































                                                                                   
#ifndef __MICROBBS_USER_H
#define __MICROBBS_USER_H

#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>

#include "kconfig.h"
#include "sds.h"
#include "logs.h"
#include "ini.h"

#include "libterm/term.h"
#include "libterm/term_io.h"

#define BBS_USER_GUEST    0 
#define BBS_USER_LOGEDIN  1
#define BBS_USER_BLOCKED  2
#define BBS_USER_LOGEDOUT 3


#define BBS_USER_UN_SZ 32
typedef struct bbs_user
{
	int login_status;
	char username[BBS_USER_UN_SZ];
} bbs_user;

typedef struct user_config_file
{
	char *password;
} user_config_file;

#define BBS_USER_INIT { BBS_USER_GUEST, {0} };

//GLOBAL USER
#ifdef __MICROBBS_MAIN
bbs_user g_user = BBS_USER_INIT;
#else
extern bbs_user g_user;
#endif

int bbs_login( term_screen *ts );
int bbs_login_auth(  const char *dir, const char *username, const char *password );

int bbs_user_init( bbs_user *bu );
int bbs_user_auth( bbs_user *bu );
int bbs_user_set_status( bbs_user *bu, int status );
int bbs_user_get_status( bbs_user *bu );

#endif