mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-09-25 10:48:50 +02:00
Add option -i <name> to initialize a player externally. (Marc H. Thoben <root@develz.org>)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@607 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
8e076008d1
commit
76be23aa5c
@ -101,6 +101,7 @@ extern int yyparse ();
|
|||||||
char * __progname;
|
char * __progname;
|
||||||
int g_idle_alarm_enabled = 0;
|
int g_idle_alarm_enabled = 0;
|
||||||
int showplayers = 0;
|
int showplayers = 0;
|
||||||
|
int initplayer = 0;
|
||||||
void (*g_chain_winch)(int);
|
void (*g_chain_winch)(int);
|
||||||
|
|
||||||
#ifndef USE_SQLITE3
|
#ifndef USE_SQLITE3
|
||||||
@ -1624,7 +1625,7 @@ autologin (char* user, char *pass)
|
|||||||
tmp = userexist(user, 0);
|
tmp = userexist(user, 0);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
me = cpy_me(tmp);
|
me = cpy_me(tmp);
|
||||||
if (passwordgood(pass) && !(me->flags & DGLACCT_LOGIN_LOCK)) {
|
if ((passwordgood(pass) || initplayer == 1) && !(me->flags & DGLACCT_LOGIN_LOCK)) {
|
||||||
loggedin = 1;
|
loggedin = 1;
|
||||||
setproctitle ("%s", me->username);
|
setproctitle ("%s", me->username);
|
||||||
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_LOGIN], 0, me);
|
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_LOGIN], 0, me);
|
||||||
@ -2539,7 +2540,7 @@ main (int argc, char** argv)
|
|||||||
|
|
||||||
__progname = basename(strdup(argv[0]));
|
__progname = basename(strdup(argv[0]));
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "sqh:pf:aeW:SD")) != -1)
|
while ((c = getopt(argc, argv, "sqh:pf:i:aeW:SD")) != -1)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -2560,6 +2561,19 @@ main (int argc, char** argv)
|
|||||||
config = strdup(optarg);
|
config = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
if (optarg && *optarg != '\0') {
|
||||||
|
if (p && *p != '\0')
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
p = strdup(optarg);
|
||||||
|
initplayer = 1;
|
||||||
|
|
||||||
|
if (auth && *auth != '\0')
|
||||||
|
*auth = '\0';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'W':
|
case 'W':
|
||||||
wall_email_str = strdup(optarg);
|
wall_email_str = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
@ -2700,6 +2714,25 @@ main (int argc, char** argv)
|
|||||||
|
|
||||||
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_DGLSTART], 0, NULL);
|
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_DGLSTART], 0, NULL);
|
||||||
|
|
||||||
|
if (initplayer) {
|
||||||
|
char *user, *pass;
|
||||||
|
|
||||||
|
user = strdup(p);
|
||||||
|
pass = strdup(p);
|
||||||
|
|
||||||
|
autologin(user, pass);
|
||||||
|
|
||||||
|
if (loggedin) {
|
||||||
|
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_REGISTER], 0, me);
|
||||||
|
fprintf(stdout, "Setup of %s succeeded.\n", me->username);
|
||||||
|
graceful_exit(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout, "Setup of %s failed.\n", p);
|
||||||
|
graceful_exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* simple login routine, uses ncurses */
|
/* simple login routine, uses ncurses */
|
||||||
if (readfile (0)) {
|
if (readfile (0)) {
|
||||||
debug_write("log in fail");
|
debug_write("log in fail");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user