]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/config.cpp
Implemented the refreshperiod config file setting
[irc/gameservirc.git] / gameserv / config.cpp
index 7adfa561a264a4abb7d9f61a58233508ee93eab0..7672c767fb7995004a3823d43880aa6112d6be77 100644 (file)
@@ -30,6 +30,7 @@ int maxafightdistance;                // Max levels above a player they can fight player->play
 int maxbfightdistance;         // Max levels below a player they can fight player->player
 int maxidletime;               // Max time (in seconds) a player can be idle for
 int idlecheckperiod;           // Period for checking every player's idle time
+long refreshperiod;            // Period for refreshing players
 long configflags;              // Holds the bit representation of some boolean values
 
 // Remote server stuff. This is used for the outgoing connection gameserv needs to make
@@ -40,6 +41,7 @@ char *remotepass;             // Password for the server link
 
 char *playerdata;              // File to store player data in
 char *monsterdata;             // File to load monster data from
+char *newsdata;                        // File to store news data in
 char *pidfile;                 // Process ID file
 
 #if defined(P10)
@@ -78,6 +80,8 @@ void unload_config_file()
        delete [] pidfile;
     if (ignoreserverslist)
        delete [] ignoreserverslist;
+    if (newsdata)
+       delete [] newsdata;
 
     configflags = 0;
 }
@@ -86,7 +90,7 @@ int load_config_file(char *config)
 {
     char *buf, *directive, *value;
 
-    #define numdirectives 21
+    #define numdirectives 23
 
     unload_config_file();
 
@@ -125,6 +129,9 @@ int load_config_file(char *config)
     directives[20].desc = "LISTENONC_FOREST - True/False as to "\
                                "whether or not to listen for forest "\
                                "commands on the forest channel";
+    directives[21].desc = "NEWSDATA - File to store daily news in";
+    directives[22].desc = "REFRESHPERIOD - Period (in seconds) to "\
+                               "refresh players";
 
     configflags = 0;
 
@@ -305,6 +312,19 @@ int load_config_file(char *config)
 
            directives[20].done = true;
        }
+       else if (stricmp(directive, "NEWSDATA") == 0)
+       {
+           value = strtok(NULL, " ");
+           newsdata = new char [strlen(value) + 1];
+           strcpy(newsdata, value);
+           directives[21].done = true;
+       }
+       else if (stricmp(directive, "REFRESHPERIOD") == 0)
+       {
+           value = strtok(NULL, " ");
+           refreshperiod = stringtoint(value);
+           directives[22].done = true;
+       }
        else if (stricmp(directive, "WELCOMEMSG") == 0)
        {
            // This directive is optional