Config-file variable allow_new_nicks
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@360 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
2659d92164
commit
7b3bcd72d7
1
config.l
1
config.l
|
@ -57,6 +57,7 @@ COMMENT ^#.*
|
||||||
"shed_gid" { return TYPE_SGID; }
|
"shed_gid" { return TYPE_SGID; }
|
||||||
"maxusers" { return TYPE_MAX; }
|
"maxusers" { return TYPE_MAX; }
|
||||||
"maxnicklen" { return TYPE_MAXNICKLEN; }
|
"maxnicklen" { return TYPE_MAXNICKLEN; }
|
||||||
|
"allow_new_nicks" { return TYPE_ALLOW_REGISTRATION; }
|
||||||
|
|
||||||
"game_num" { return TYPE_GAMENUM; }
|
"game_num" { return TYPE_GAMENUM; }
|
||||||
|
|
||||||
|
|
7
config.y
7
config.y
|
@ -32,6 +32,7 @@ static const char* lookup_token (int t);
|
||||||
|
|
||||||
%token TYPE_SUSER TYPE_SGROUP TYPE_SGID TYPE_SUID TYPE_MAX TYPE_MAXNICKLEN
|
%token TYPE_SUSER TYPE_SGROUP TYPE_SGID TYPE_SUID TYPE_MAX TYPE_MAXNICKLEN
|
||||||
%token TYPE_PATH_CHDIR TYPE_PATH_MKDIR TYPE_GAME_SHORT_NAME
|
%token TYPE_PATH_CHDIR TYPE_PATH_MKDIR TYPE_GAME_SHORT_NAME
|
||||||
|
%token TYPE_ALLOW_REGISTRATION
|
||||||
%token TYPE_PATH_GAME TYPE_NAME_GAME TYPE_PATH_DGLDIR TYPE_PATH_SPOOL
|
%token TYPE_PATH_GAME TYPE_NAME_GAME TYPE_PATH_DGLDIR TYPE_PATH_SPOOL
|
||||||
%token TYPE_PATH_BANNER TYPE_PATH_CANNED TYPE_PATH_CHROOT TYPE_GAMENUM
|
%token TYPE_PATH_BANNER TYPE_PATH_CANNED TYPE_PATH_CHROOT TYPE_GAMENUM
|
||||||
%token TYPE_PATH_PASSWD TYPE_PATH_LOCKFILE TYPE_PATH_SAVEFILEFMT
|
%token TYPE_PATH_PASSWD TYPE_PATH_LOCKFILE TYPE_PATH_SAVEFILEFMT
|
||||||
|
@ -282,6 +283,10 @@ KeyPair: KeyType '=' TYPE_VALUE {
|
||||||
num_games = ncnf;
|
num_games = ncnf;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TYPE_ALLOW_REGISTRATION:
|
||||||
|
globalconfig.allow_registration = $3;
|
||||||
|
break;
|
||||||
|
|
||||||
case TYPE_MAX:
|
case TYPE_MAX:
|
||||||
globalconfig.max = $3;
|
globalconfig.max = $3;
|
||||||
break;
|
break;
|
||||||
|
@ -305,6 +310,7 @@ KeyType : TYPE_SUSER { $$ = TYPE_SUSER; }
|
||||||
| TYPE_MAXNICKLEN { $$ = TYPE_MAXNICKLEN; }
|
| TYPE_MAXNICKLEN { $$ = TYPE_MAXNICKLEN; }
|
||||||
| TYPE_GAMENUM { $$ = TYPE_GAMENUM; }
|
| TYPE_GAMENUM { $$ = TYPE_GAMENUM; }
|
||||||
| TYPE_PATH_CHROOT { $$ = TYPE_PATH_CHROOT; }
|
| TYPE_PATH_CHROOT { $$ = TYPE_PATH_CHROOT; }
|
||||||
|
| TYPE_ALLOW_REGISTRATION { $$ = TYPE_ALLOW_REGISTRATION; }
|
||||||
| TYPE_PATH_GAME { $$ = TYPE_PATH_GAME; }
|
| TYPE_PATH_GAME { $$ = TYPE_PATH_GAME; }
|
||||||
| TYPE_NAME_GAME { $$ = TYPE_NAME_GAME; }
|
| TYPE_NAME_GAME { $$ = TYPE_NAME_GAME; }
|
||||||
| TYPE_GAME_SHORT_NAME { $$ = TYPE_GAME_SHORT_NAME; }
|
| TYPE_GAME_SHORT_NAME { $$ = TYPE_GAME_SHORT_NAME; }
|
||||||
|
@ -340,6 +346,7 @@ const char* lookup_token (int t)
|
||||||
case TYPE_PATH_MKDIR: return "mkdir";
|
case TYPE_PATH_MKDIR: return "mkdir";
|
||||||
case TYPE_PATH_GAME: return "game_path";
|
case TYPE_PATH_GAME: return "game_path";
|
||||||
case TYPE_NAME_GAME: return "game_name";
|
case TYPE_NAME_GAME: return "game_name";
|
||||||
|
case TYPE_ALLOW_REGISTRATION: return "allow_new_nicks";
|
||||||
case TYPE_GAME_SHORT_NAME: return "short_name";
|
case TYPE_GAME_SHORT_NAME: return "short_name";
|
||||||
case TYPE_PATH_DGLDIR: return "dglroot";
|
case TYPE_PATH_DGLDIR: return "dglroot";
|
||||||
case TYPE_PATH_SPOOL: return "spooldir";
|
case TYPE_PATH_SPOOL: return "spooldir";
|
||||||
|
|
|
@ -774,7 +774,10 @@ drawmenu ()
|
||||||
{
|
{
|
||||||
mvaddstr (banner.len + 2, 1, "Not logged in.");
|
mvaddstr (banner.len + 2, 1, "Not logged in.");
|
||||||
mvaddstr (banner.len + 4, 1, "l) Login");
|
mvaddstr (banner.len + 4, 1, "l) Login");
|
||||||
mvaddstr (banner.len + 5, 1, "r) Register new user");
|
if (globalconfig.allow_registration)
|
||||||
|
mvaddstr (banner.len + 5, 1, "r) Register new user");
|
||||||
|
else
|
||||||
|
mvaddstr (banner.len + 5, 1, " Register new user - DISABLED");
|
||||||
mvaddstr (banner.len + 6, 1, "w) Watch games in progress");
|
mvaddstr (banner.len + 6, 1, "w) Watch games in progress");
|
||||||
mvaddstr (banner.len + 7, 1, "q) Quit");
|
mvaddstr (banner.len + 7, 1, "q) Quit");
|
||||||
mvaddstr (banner.len + 11, 1, "=> ");
|
mvaddstr (banner.len + 11, 1, "=> ");
|
||||||
|
@ -1619,7 +1622,7 @@ gamemenuloop(int game)
|
||||||
graceful_exit(0);*/
|
graceful_exit(0);*/
|
||||||
/* break; */
|
/* break; */
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!loggedin) /*not visible to loggedin */
|
if (!loggedin && globalconfig.allow_registration)
|
||||||
newuser ();
|
newuser ();
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct dg_globalconfig
|
||||||
gid_t shed_gid;
|
gid_t shed_gid;
|
||||||
char* passwd;
|
char* passwd;
|
||||||
char* lockfile;
|
char* lockfile;
|
||||||
|
int allow_registration; /* allow registering new nicks */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
|
|
|
@ -276,6 +276,8 @@ create_config ()
|
||||||
FILE *config_file = NULL;
|
FILE *config_file = NULL;
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
|
if (!globalconfig.allow_registration) globalconfig.allow_registration = 1;
|
||||||
|
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
if ((config_file = fopen(config, "r")) != NULL)
|
if ((config_file = fopen(config, "r")) != NULL)
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
# Max amount of registered users to allow.
|
# Max amount of registered users to allow.
|
||||||
maxusers = 64000
|
maxusers = 64000
|
||||||
|
|
||||||
|
# Allow registration of new nicks? (0 or 1)
|
||||||
|
allow_new_nicks = 1
|
||||||
|
|
||||||
# Max length for newly registered nicks. Must be less than 20.
|
# Max length for newly registered nicks. Must be less than 20.
|
||||||
# By default, NetHack only stores the first 10 chars of a name into
|
# By default, NetHack only stores the first 10 chars of a name into
|
||||||
# the record/logfile.
|
# the record/logfile.
|
||||||
|
|
Loading…
Reference in New Issue