tNew ServerMOTD variable to welcome players to a dopewars server. - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ed6cca66b21106aaa2416b47811c3a3775bed088
 (DIR) parent 801f0c99838c8ec5560b70ef2b6b9f1b921c30d4
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Fri, 22 Mar 2002 13:43:16 +0000
       
       New ServerMOTD variable to welcome players to a dopewars server.
       
       
       Diffstat:
         M ChangeLog                           |       2 ++
         M doc/configfile.html                 |       8 +++++++-
         M src/dopewars.c                      |       6 ++++++
         M src/dopewars.h                      |       2 +-
         M src/message.h                       |       2 +-
         M src/serverside.c                    |       3 +++
       
       6 files changed, 20 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/ChangeLog b/ChangeLog
       t@@ -2,6 +2,8 @@ cvs
            - Incorrect handling of WM_CLOSE under Win32 fixed
            - Unix server now fails "gracefully" if it cannot create the Unix domain
              socket for admin connections
       +    - New ServerMOTD variable to welcome players to a server (with thanks
       +      to Mike Robinson)
        
        1.5.4   03-03-2002
            - Basic configuration file editor added to GTK+ client
 (DIR) diff --git a/doc/configfile.html b/doc/configfile.html
       t@@ -91,6 +91,12 @@ This option can be overridden with the -o <a href="commandline.html#server">
        command line option</a> (but be sure to protect the brackets from the shell
        if you use one of the "special" names).</dd>
        
       +<dt><b>ServerMOTD=<i>"Welcome to my dopewars server"</i></b></dt>
       +<dd>When running a server, any client that connects displays the welcome
       +"message of the day" <i>"Welcome to my dopewars server"</i>. This can
       +be used, for example, to inform users of any special features that the
       +server has.</dd>
       +
        <dt><b>Socks.Active=<i>FALSE</i></b></dt>
        <dd>Instructs the dopewars client to connect directly to the given server,
        without using an intermediate SOCKS server. If this is set to TRUE, all
       t@@ -612,6 +618,6 @@ any drugs, and clients will display this information if available.</dd>
        <ul>
        <li><a href="index.html">Main index</a></li>
        </ul>
       -<p>Last update: <b>15-02-2002</b></p>
       +<p>Last update: <b>22-03-2002</b></p>
        </body>
        </html>
 (DIR) diff --git a/src/dopewars.c b/src/dopewars.c
       t@@ -77,6 +77,7 @@ gboolean Network, Client, Server, NotifyMetaServer, AIPlayer;
        unsigned Port = 7902;
        gboolean Sanitized, ConfigVerbose, DrugValue;
        gchar *HiScoreFile = NULL, *ServerName = NULL, *ConvertFile = NULL;
       +gchar *ServerMOTD = NULL;
        gboolean WantHelp, WantVersion, WantAntique, WantColour, WantNetwork;
        gboolean WantConvert, WantAdmin;
        
       t@@ -226,6 +227,9 @@ struct GLOBALS Globals[] = {
          {NULL, NULL, NULL, &ServerName, NULL, "Server",
           N_("Name of the server to connect to"), NULL, NULL, 0, "", NULL,
           NULL, FALSE},
       +  {NULL, NULL, NULL, &ServerMOTD, NULL, "ServerMOTD",
       +   N_("Server's welcome message of the day"), NULL, NULL, 0, "", NULL,
       +   NULL, FALSE},
        #ifdef NETWORKING
          {NULL, &UseSocks, NULL, NULL, NULL, "Socks.Active",
           N_("TRUE if a SOCKS server should be used for networking"),
       t@@ -2400,8 +2404,10 @@ void SetupParameters(void)
          /* Set hard-coded default values */
          g_free(HiScoreFile);
          g_free(ServerName);
       +  g_free(ServerMOTD);
          HiScoreFile = g_strdup_printf("%s/dopewars.sco", DATADIR);
          ServerName = g_strdup("localhost");
       +  ServerMOTD = g_strdup("");
          g_free(WebBrowser);
          WebBrowser = g_strdup("/usr/bin/mozilla");
        
 (DIR) diff --git a/src/dopewars.h b/src/dopewars.h
       t@@ -159,7 +159,7 @@ extern unsigned Port;
        extern gboolean Sanitized, ConfigVerbose, DrugValue;
        extern int NumLocation, NumGun, NumCop, NumDrug, NumSubway, NumPlaying,
                   NumStoppedTo;
       -extern gchar *HiScoreFile, *ServerName, *ConvertFile;
       +extern gchar *HiScoreFile, *ServerName, *ConvertFile, *ServerMOTD;
        extern gboolean WantHelp, WantVersion, WantAntique, WantColour,
                        WantNetwork, WantConvert, WantAdmin;
        #ifdef CYGWIN
 (DIR) diff --git a/src/message.h b/src/message.h
       t@@ -49,7 +49,7 @@ typedef enum {
          C_NONE = 'A',
          C_ASKLOAN, C_COPSMESG, C_ASKBITCH, C_ASKGUN, C_ASKGUNSHOP,
          C_ASKPUB, C_ASKBANK, C_ASKRUN, C_ASKRUNFIGHT, C_ASKSEW,
       -  C_MEETPLAYER, C_FIGHT, C_FIGHTDONE
       +  C_MEETPLAYER, C_FIGHT, C_FIGHTDONE, C_MOTD
        } AICode;
        
        #define DT_LOCATION    'A'
 (DIR) diff --git a/src/serverside.c b/src/serverside.c
       t@@ -399,6 +399,9 @@ void HandleServerMessage(gchar *buf, Player *Play)
                    SendPlayerDetails(pt, Play, C_LIST);
                  }
                }
       +        if (ServerMOTD && ServerMOTD[0]) {
       +          SendPrintMessage(NULL, C_MOTD, Play, ServerMOTD);
       +        }
                SendServerMessage(NULL, C_NONE, C_ENDLIST, Play, NULL);
                RegisterWithMetaServer(TRUE, FALSE, TRUE);
                Play->ConnectTimeout = 0;