]> skyeroc.xyz Git - dgamelaunch/commitdiff
Add $SERVERID and server_id stuff so admin can change the server ID (url, telnet...
authorPasi Kallinen <paxed@alt.org>
Sun, 6 Apr 2008 11:21:29 +0000 (11:21 +0000)
committerPasi Kallinen <paxed@alt.org>
Sun, 6 Apr 2008 11:21:29 +0000 (11:21 +0000)
config file.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@444 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.l
config.y
dgamelaunch.c
dgamelaunch.h
dgl-common.c
examples/dgamelaunch.conf

index f632c52e1e3f13ba1abd9066dc02c82b9b55da23..e4f71b76e949d602ff2eeb438abbb2ae6e7dfc95 100644 (file)
--- a/config.l
+++ b/config.l
@@ -83,6 +83,7 @@ cursor                { return TYPE_CURSOR; }
 "inprogressdir" { return TYPE_PATH_INPROGRESS; }
 "game_args"    { return TYPE_GAME_ARGS; }
 "rc_fmt"       { return TYPE_RC_FMT; }
+server_id      { return TYPE_SERVER_ID; }
 sortmode       { return TYPE_WATCH_SORTMODE; }
 commands       { return TYPE_CMDQUEUE; }
 yes            { yylval.i = 1; return TYPE_BOOL; }
index 973b933cbe7838df952532ad54a087018c5dc41e..7750514006b63d34b6c2dba51fb98e3bfa7753f6 100644 (file)
--- a/config.y
+++ b/config.y
@@ -34,7 +34,7 @@ static const char* lookup_token (int t);
 }
 
 %token TYPE_SUSER TYPE_SGROUP TYPE_SGID TYPE_SUID TYPE_MAX TYPE_MAXNICKLEN
-%token TYPE_GAME_SHORT_NAME TYPE_WATCH_SORTMODE
+%token TYPE_GAME_SHORT_NAME TYPE_WATCH_SORTMODE TYPE_SERVER_ID
 %token TYPE_ALLOW_REGISTRATION
 %token TYPE_PATH_GAME TYPE_NAME_GAME TYPE_PATH_DGLDIR TYPE_PATH_SPOOL
 %token TYPE_PATH_BANNER TYPE_PATH_CANNED TYPE_PATH_CHROOT
@@ -170,6 +170,11 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
       }
       break;
 
+  case TYPE_SERVER_ID:
+      if (globalconfig.server_id) free(globalconfig.server_id);
+      globalconfig.server_id = strdup($3);
+      break;
+
     case TYPE_PATH_DGLDIR:
       if (globalconfig.dglroot) free(globalconfig.dglroot);
       globalconfig.dglroot = strdup($3);
@@ -526,6 +531,7 @@ KeyType : TYPE_SUSER        { $$ = TYPE_SUSER; }
        | TYPE_PATH_INPROGRESS  { $$ = TYPE_PATH_INPROGRESS; }
        | TYPE_RC_FMT           { $$ = TYPE_RC_FMT; }
        | TYPE_WATCH_SORTMODE   { $$ = TYPE_WATCH_SORTMODE; }
+       | TYPE_SERVER_ID        { $$ = TYPE_SERVER_ID; }
        ;
 
 %%
@@ -553,6 +559,7 @@ const char* lookup_token (int t)
     case TYPE_GAME_ARGS: return "game_args";
     case TYPE_RC_FMT: return "rc_fmt";
     case TYPE_WATCH_SORTMODE: return "sortmode";
+    case TYPE_SERVER_ID: return "server_id";
     default: abort();
   }
 }
index b2bd6f0fbf1d4ade4c96024e9b3e5ebe41ec7952..c43e8a5540dc55d65b3bffedf1a9a2275c7c1f15 100644 (file)
@@ -323,8 +323,11 @@ loadbanner (char *fname, struct dg_banner *ban)
 
       strncpy(bufnew, buf, 80);
       strncpy(bufnew, bannerstrmangle(bufnew, "$VERSION", PACKAGE_STRING), 80);
+      strncpy(bufnew, bannerstrmangle(bufnew, "$SERVERID", globalconfig.server_id ? globalconfig.server_id : ""), 80);
       if (me && loggedin) {
          strncpy(bufnew, bannerstrmangle(bufnew, "$USERNAME", me->username), 80);
+      } else {
+         strncpy(bufnew, bannerstrmangle(bufnew, "$USERNAME", "[Anonymous]"), 80);
       }
       ban->lines[ban->len - 1] = strdup(bufnew);
 
index 8970919c302571604353a0d5faaadf3406805334..29afbfd4a52406f36b4e38d3faba39442c891ed0 100644 (file)
@@ -111,6 +111,7 @@ struct dg_globalconfig
     char* lockfile;
     int allow_registration; /* allow registering new nicks */
     int sortmode; /* default watching-screen sortmode */
+    char *server_id; /* string for the server name or whatever */
 
     struct dg_cmdpart *cmdqueue[NUM_DGLTIMES];
 
index efd648d3913e12726743bb7d60e3a72f71ebd720..96c3dba3e56234b2ac4f5917ba29c22e3618d65d 100644 (file)
@@ -527,6 +527,7 @@ create_config ()
 
   if (!globalconfig.allow_registration) globalconfig.allow_registration = 1;
   globalconfig.menulist = NULL;
+  globalconfig.server_id = NULL;
 
   globalconfig.sortmode = SORTMODE_NONE;
 
index d89a198faba29aeec9343f92d36f37bf81347227..dfc009a42e4a0d812178898b6f40be36cf77a824 100644 (file)
@@ -29,9 +29,14 @@ chroot_path = "/var/lib/dgamelaunch/"
 # From inside the jail, dgamelaunch's working directory for rcfiles/ttyrec/etc
 dglroot = "/dgldir/"
 
+# Server ID string
+server_id = "nethack.alt.org - http://nethack.alt.org/"
+
 # From inside the jail, location of a banner file, the topmost line will be
 # shown in submenus that cannot be defined separately.
-# string $VERSION will be replaced with "dgamelaunch v" + dgl version number.
+# Some string substitution is done for the file:
+# $VERSION   replaced with "dgamelaunch v" + dgl version number.
+# $SERVERID  replaced with the server_id string, as defined above.
 banner = "/dgl-banner"
 
 # The following two options are fairly insecure. They will force us to
@@ -110,8 +115,7 @@ commands[register] = mkdir "%rttyrec/%n"
 
 # define the main menus. you _must_ define "mainmenu_anon"
 # and "mainmenu_user".
-# $VERSION will be replaced with dgl version string, as
-# in the bannerfile above.
+# $VERSION and $SERVERID will be replaced, as per the bannerfile above.
 # first, the menu shown to anonymous user:
 menu["mainmenu_anon"] {
         bannerfile = "dgl_menu_main_anon.txt"