--remove editoptions() and the editor compiled into dgl.
-
-move the games[] array into shmem?
-$MTIME(filename)
key not defined in other commands):
commands[default] = ...
--in watching-menu, maybe we shouldn't pick players who have been
- idle for too long when randomly choosing one to watch.
-change dgl-banner handling; we only use the top line of it nowadays...
(maybe make that info config line: bannerline = "## $SERVERID" or something)
-allow the admin to config the watching menu:
/* ************************************************************* */
+char *
+get_mainmenu_name()
+{
+ if (loggedin) {
+ if (me && (me->flags & DGLACCT_ADMIN)) return "mainmenu_admin";
+ return "mainmenu_user";
+ }
+ return "mainmenu_anon";
+}
+
+
char*
gen_ttyrec_filename ()
{
clear();
+ if (me->flags & DGLACCT_EMAIL_LOCK) {
+ drawbanner(&banner, 1, 1);
+ mvprintw(5, 1, "Sorry, you cannot change the email.--More--");
+ dgl_getch();
+ return;
+ }
+
for (;;)
{
drawbanner(&banner, 1,1);
graceful_exit (122); /* Die. */
}
+ if (me->flags & DGLACCT_PASSWD_LOCK) {
+ clear();
+ drawbanner(&banner, 1, 1);
+ mvprintw(5, 1, "Sorry, you cannot change the password.--More--");
+ dgl_getch();
+ return 0;
+ }
+
while (error)
{
char repeatbuf[DGL_PASSWDLEN+1];
tmp = userexist(user, 0);
if (tmp) {
me = cpy_me(tmp);
- if (passwordgood(pass)) {
+ if (passwordgood(pass) && !(me->flags & DGLACCT_LOGIN_LOCK)) {
loggedin = 1;
setproctitle ("%s", me->username);
dgl_exec_cmdqueue(globalconfig.cmdqueue[DGLTIME_LOGIN], 0, me);
if (passwordgood (pw_buf))
{
+ if (me->flags & DGLACCT_LOGIN_LOCK) {
+ clear ();
+ mvprintw(5, 1, "Sorry, that account has been banned.--More--");
+ dgl_getch();
+ return;
+ }
+
loggedin = 1;
if (from_ttyplay)
setproctitle("%s [watching %s]", me->username, chosen_name);
me->email = strdup (buf);
me->env = calloc (1, 1);
+ me->flags = 0;
loggedin = 1;
idle_alarm_set_enabled(1);
while (1) {
- if (runmenuloop(dgl_find_menu(loggedin ? "mainmenu_user" : "mainmenu_anon")))
+ if (runmenuloop(dgl_find_menu(get_mainmenu_name())))
break;
}
# define CLR_RED 0
#endif
+typedef enum
+{
+ DGLACCT_ADMIN = 0x01, /* admin account */
+ DGLACCT_LOGIN_LOCK = 0x02, /* account is banned and cannot login */
+ DGLACCT_PASSWD_LOCK = 0x04, /* account password cannot be changed */
+ DGLACCT_EMAIL_LOCK = 0x08 /* account email cannot be changed */
+} dgl_acct_flag;
+
typedef enum
{
DGLTIME_DGLSTART = 0, /* when someone telnets in */
char *email;
char *env;
char *password;
- int flags;
+ int flags; /* dgl_acct_flag bitmask */
};
struct dg_banner
/* dgamelaunch.c */
extern void create_config(void);
extern void ttyrec_getmaster(void);
+extern char *get_mainmenu_name(void);
extern char *gen_ttyrec_filename(void);
extern char *gen_inprogress_lock(int game, pid_t pid, char *ttyrec_filename);
extern void catch_sighup(int signum);