Version 1.2.2
+* Added an optional config file directive USEPRIVMSG which makes
+ gameserv use /msg instead of /notice - kain
+* Made the ignoreservers config file option work for bahamut - kain
* Fixed an error in do_register that was not adding the client to the
players list correctly, causing newly registered players to be
locked out of identifying until the next gameserv restart - kain
#include <stdlib.h>
#include <stdio.h>
#include "extern.h"
+#include "flags.h"
using std::ifstream;
using std::cerr;
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
-bool listenonc_forest; // If true, listen for commands on the forest channel
+long configflags; // Holds the bit representation of some boolean values
// Remote server stuff. This is used for the outgoing connection gameserv needs to make
// to a real ircd.
delete [] pidfile;
if (ignoreserverslist)
delete [] ignoreserverslist;
+
+ configflags = 0;
}
int load_config_file(char *config)
"whether or not to listen for forest "\
"commands on the forest channel";
+ configflags = 0;
+
for (int count = 0; count < numdirectives; count++)
{
directives[count].done = false;
{
value = strtok(NULL, " ");
if (stricmp(value, "TRUE") == 0)
- listenonc_forest = true;
- else
- listenonc_forest = false;
+ setListenOnCF(configflags);
directives[21].done = true;
}
+ else if (stricmp(directive, "USEPRIVMSG") == 0)
+ {
+ // This directive is optional
+ setUsePrivmsg(configflags);
+ }
else if (stricmp(directive, "IGNORESERVERS") == 0)
{
// This directive is optional
E char *welcomemsg;
E char *ignoreserverslist;
-E bool listenonc_forest;
+E long configflags;
E bool shuttingdown;
E int welcomedelay;
E int updateperiod;
#define FLAG_YOURTURN 0x0004
#define FLAG_WONGAME 0x0008
+// Config File flags
+#define CFLAG_LISTENONCF 0x0001
+#define CFLAG_USEPRIVMSG 0x0002
+
+#define setListenOnCF(x) (x |= CFLAG_LISTENONCF)
+#define clearListenOnCF(x) (x &= ~CFLAG_LISTENONCF)
+#define isListenonCF(x) (x & CFLAG_LISTENONCF)
+
+#define setUsePrivmsg(x) (x |= CFLAG_USEPRIVMSG)
+#define clearUsePrivmsg(x) (x &= ~CFLAG_USEPRIVMSG)
+#define isUsePrivmsg(x) (x & CFLAG_USEPRIVMSG)
// aClient flags
// #define ADMIN_FLAGS(FLAG_ONE | FLAG_TWO | FLAG_ETC)
if (fmt[0] == '\0')
return;
+ char *commanduse;
+ commanduse = new char[16];
+
+ #ifdef P10
+ if (isUsePrivmsg(configflags))
+ strncpy(commanduse, "P", 1);
+ else
+ strncpy(commanduse, "N", 1);
+ #else
+
+ if (isUsePrivmsg(configflags))
+ strncpy(commanduse, "PRIVMSG", 7);
+ else
+ strncpy(commanduse, "NOTICE", 6);
+ #endif
+
va_list args;
char *input;
const char *t = fmt;
dest++;
#if !defined(P10)
- sprintf(input, ":%s NOTICE %s :", source, dest);
+ sprintf(input, ":%s %s %s :", source, commanduse, dest);
#else
- sprintf(input, "%s O %s :", gsnum, dest);
+ sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
#endif
dest--;
else
{
#if !defined(P10)
- sprintf(input, ":%s NOTICE %s :", source, dest);
+ sprintf(input, ":%s %s %s :", source, commanduse, dest);
#else
- sprintf(input, "%s O %s :", gsnum, dest);
+ sprintf(input, "%s %s %s :", gsnum, commanduse, dest);
#endif
}
#endif
sprintf(input, "%s%s", input, "\r\n");
sock_puts(sock, input);
+ delete [] commanduse;
delete [] input;
va_end(args);
}
delete [] longname;
gameserv(source, rest);
}
- else if (stricmp(dest, c_Forest) == 0 && listenonc_forest)
+ else if (stricmp(dest, c_Forest) == 0 && isListenOnCF(configflags))
{
delete [] longname;
forest(source, rest);