Add new config-file commands for quit, watch_menu, ask_login and ask_register

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@422 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2008-01-14 22:06:32 +00:00
parent ea203348e1
commit b57983ec56
5 changed files with 50 additions and 5 deletions

29
TODO
View File

@ -1,10 +1,10 @@
-add new config file commands:
x -chpasswd (change user's password)
-chmail (change user's email address)
-watch_menu (go to the watching menu)
-login (login user)
-newuser (register new user)
-quit (quit from dgl)
x -chmail (change user's email address)
x -watch_menu (go to the watching menu)
x -login (login user)
x -newuser (register new user)
x -quit (quit from dgl)
-game_menu "x" (go to game menu "x")
-return (return to main menu)
-start_game (start the selected game)
@ -95,6 +95,23 @@
and maybe allow changing the watching-screen layout too?
struct dg_menuoption
{
char *keys;
struct dg_cmdpart *cmdqueue;
struct dg_menuoption *next;
};
struct dg_menu
{
char *banner_fn;
int cursor_x, cursor_y; /* coord to put cursor after drawing banner */
struct dg_menuoption *options;
};
-add commandline parameters to dgamelaunch:
dgamelaunch --chpasswd "nick" "newpass"
@ -104,6 +121,8 @@
-some games (robotfindskitten?) are not worth saving into ttyrecs, make it configurable.
-allow configuring ttyplay.c; some games may use different clear-screen
commands. (see for example crawl)
-allow configuring the gfx stripping. (number of chars, types of stripping,
include unicode stripping from crawl dgl, etc)
-public (no-password) accounts? (a per-user flag) what happens when someone
is playing on the account and someone else logins and we start playing?
-change the watching screen not to show the 'press 'm' to mail user'

View File

@ -94,6 +94,10 @@ setenv { yylval.i = DGLCMD_SETENV; return TYPE_DGLCMD2; }
exec { yylval.i = DGLCMD_EXEC; return TYPE_DGLCMD2; }
chpasswd { yylval.i = DGLCMD_CHPASSWD; return TYPE_DGLCMD0; }
chmail { yylval.i = DGLCMD_CHMAIL; return TYPE_DGLCMD0; }
watch_menu { yylval.i = DGLCMD_WATCH_MENU; return TYPE_DGLCMD0; }
ask_login { yylval.i = DGLCMD_LOGIN; return TYPE_DGLCMD0; }
ask_register { yylval.i = DGLCMD_REGISTER; return TYPE_DGLCMD0; }
quit { yylval.i = DGLCMD_QUIT; return TYPE_DGLCMD0; }
DEFINE { return TYPE_DEFINE_GAME; }

View File

@ -104,6 +104,10 @@ typedef enum
DGLCMD_UNLINK, /* unlink foo */
DGLCMD_EXEC, /* exec foo bar */
DGLCMD_SETENV, /* setenv foo bar */
DGLCMD_WATCH_MENU, /* watch_menu */
DGLCMD_LOGIN, /* ask_login */
DGLCMD_REGISTER, /* ask_register */
DGLCMD_QUIT, /* quit */
DGLCMD_CHMAIL, /* chmail */
DGLCMD_CHPASSWD /* chpasswd */
} dglcmd_actions;

View File

@ -203,6 +203,19 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
case DGLCMD_CHMAIL:
if (loggedin) change_email();
break;
case DGLCMD_WATCH_MENU:
inprogressmenu(game);
break;
case DGLCMD_LOGIN:
if (!loggedin) loginprompt(0);
break;
case DGLCMD_REGISTER:
if (!loggedin && globalconfig.allow_registration) newuser();
break;
case DGLCMD_QUIT:
endwin();
graceful_exit(0);
/* break; */
}
free(p1);
free(p2);

View File

@ -77,6 +77,11 @@ lockfile = "/dgl-lock"
# exec "foo" "bar" = execute "foo" with "bar" as it's param
# chpasswd = do the change password prompting, if logged in
# chmail = do the change email prompting, if logged in
# watch_menu = go to the watching menu
# quit = quit dgl
# ask_login = do the login prompting, if not logged in
# ask_register = do register new user prompting, if not logged in and
# registration of new nicks is allowed.
#
# The commands will be done inside the chroot and with the uid and gid
# defined above.