2012-04-19 20:58:29 +02:00
|
|
|
/*
|
|
|
|
* InspIRCd -- Internet Relay Chat Daemon
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
2012-04-19 20:58:29 +02:00
|
|
|
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
|
|
|
|
* Copyright (C) 2007, 2009 Dennis Friis <peavey@inspircd.org>
|
|
|
|
* Copyright (C) 2006-2008 Craig Edwards <craigedwards@brainbox.cc>
|
|
|
|
* Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net>
|
|
|
|
* Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
2012-04-19 20:58:29 +02:00
|
|
|
* This file is part of InspIRCd. InspIRCd is free software: you can
|
|
|
|
* redistribute it and/or modify it under the terms of the GNU General Public
|
|
|
|
* License as published by the Free Software Foundation, version 2.
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
2012-04-19 20:58:29 +02:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
|
|
|
|
2012-04-19 20:58:29 +02:00
|
|
|
|
2013-04-02 20:12:15 +01:00
|
|
|
#pragma once
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include "inspircd.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "socketengine.h"
|
|
|
|
#include "socket.h"
|
2017-08-17 18:32:19 +01:00
|
|
|
#include "token_list.h"
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2012-07-05 21:00:35 +01:00
|
|
|
/** Structure representing a single \<tag> in config */
|
2009-10-22 22:29:35 +00:00
|
|
|
class CoreExport ConfigTag : public refcountbase
|
2008-03-23 20:43:35 +00:00
|
|
|
{
|
2016-12-08 01:57:47 +00:00
|
|
|
ConfigItems items;
|
2009-10-22 22:29:35 +00:00
|
|
|
public:
|
2009-10-17 02:14:44 +00:00
|
|
|
const std::string tag;
|
2009-10-17 17:53:22 +00:00
|
|
|
const std::string src_name;
|
|
|
|
const int src_line;
|
2008-10-18 16:52:48 +00:00
|
|
|
|
2009-10-22 22:29:35 +00:00
|
|
|
/** Get the value of an option, using def if it does not exist */
|
2017-08-17 14:54:49 +01:00
|
|
|
std::string getString(const std::string& key, const std::string& def = "", size_t minlen = 0, size_t maxlen = UINT32_MAX);
|
2009-10-22 22:29:35 +00:00
|
|
|
/** Get the value of an option, using def if it does not exist */
|
2013-07-10 14:28:05 +01:00
|
|
|
long getInt(const std::string& key, long def = 0, long min = LONG_MIN, long max = LONG_MAX);
|
2009-10-22 22:29:35 +00:00
|
|
|
/** Get the value of an option, using def if it does not exist */
|
2009-10-17 02:14:44 +00:00
|
|
|
double getFloat(const std::string& key, double def = 0);
|
2009-10-22 22:29:35 +00:00
|
|
|
/** Get the value of an option, using def if it does not exist */
|
2009-10-17 02:14:44 +00:00
|
|
|
bool getBool(const std::string& key, bool def = false);
|
2008-10-18 16:52:48 +00:00
|
|
|
|
2013-08-12 19:20:18 +02:00
|
|
|
/** Get the value in seconds of a duration that is in the user-friendly "1h2m3s" format,
|
|
|
|
* using a default value if it does not exist or is out of bounds.
|
|
|
|
* @param key The config key name
|
|
|
|
* @param def Default value (optional)
|
|
|
|
* @param min Minimum acceptable value (optional)
|
|
|
|
* @param max Maximum acceptable value (optional)
|
|
|
|
* @return The duration in seconds
|
|
|
|
*/
|
2013-08-27 15:03:10 +02:00
|
|
|
long getDuration(const std::string& key, long def = 0, long min = LONG_MIN, long max = LONG_MAX);
|
2013-08-12 19:20:18 +02:00
|
|
|
|
2009-10-22 22:29:35 +00:00
|
|
|
/** Get the value of an option
|
|
|
|
* @param key The option to get
|
|
|
|
* @param value The location to store the value (unmodified if does not exist)
|
|
|
|
* @param allow_newline Allow newlines in the option (normally replaced with spaces)
|
|
|
|
* @return true if the option exists
|
|
|
|
*/
|
2009-10-17 02:14:44 +00:00
|
|
|
bool readString(const std::string& key, std::string& value, bool allow_newline = false);
|
2009-10-17 17:53:22 +00:00
|
|
|
|
2013-08-12 19:20:18 +02:00
|
|
|
/** Check for an out of range value. If the value falls outside the boundaries a warning is
|
|
|
|
* logged and the value is corrected (set to def).
|
|
|
|
* @param key The key name, used in the warning message
|
|
|
|
* @param res The value to verify and modify if needed
|
|
|
|
* @param def The default value, res will be set to this if (min <= res <= max) doesn't hold true
|
|
|
|
* @param min Minimum accepted value for res
|
|
|
|
* @param max Maximum accepted value for res
|
|
|
|
*/
|
|
|
|
void CheckRange(const std::string& key, long& res, long def, long min, long max);
|
|
|
|
|
2009-10-17 17:53:22 +00:00
|
|
|
std::string getTagLocation();
|
2009-10-22 22:29:35 +00:00
|
|
|
|
2016-12-08 01:57:47 +00:00
|
|
|
inline const ConfigItems& getItems() const { return items; }
|
2009-10-23 19:07:40 +00:00
|
|
|
|
2016-12-08 01:57:47 +00:00
|
|
|
/** Create a new ConfigTag, giving access to the private ConfigItems item list */
|
|
|
|
static ConfigTag* create(const std::string& Tag, const std::string& file, int line, ConfigItems*& Items);
|
2009-10-22 22:29:35 +00:00
|
|
|
private:
|
|
|
|
ConfigTag(const std::string& Tag, const std::string& file, int line);
|
2008-03-23 20:43:35 +00:00
|
|
|
};
|
|
|
|
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Defines the server's length limits on various length-limited
|
|
|
|
* items such as topics, nicknames, channel names etc.
|
|
|
|
*/
|
2009-09-02 00:46:11 +00:00
|
|
|
class ServerLimits
|
2008-05-25 17:30:43 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum nickname length */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t NickMax;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum channel length */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t ChanMax;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum number of modes per line */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t MaxModes;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum length of ident, not including ~ etc */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t IdentMax;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum length of a quit message */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t MaxQuit;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum topic length */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t MaxTopic;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum kick message length */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t MaxKick;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum GECOS (real name) length */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t MaxGecos;
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Maximum away message length */
|
2008-05-25 17:30:43 +00:00
|
|
|
size_t MaxAway;
|
2013-05-17 01:31:32 +01:00
|
|
|
/** Maximum line length */
|
|
|
|
size_t MaxLine;
|
2014-03-06 21:43:36 +00:00
|
|
|
/** Maximum hostname length */
|
|
|
|
size_t MaxHost;
|
2008-05-25 17:30:43 +00:00
|
|
|
|
2014-12-09 12:35:31 +01:00
|
|
|
/** Read all limits from a config tag. Limits which aren't specified in the tag are set to a default value.
|
|
|
|
* @param tag Configuration tag to read the limits from
|
|
|
|
*/
|
|
|
|
ServerLimits(ConfigTag* tag);
|
2016-07-22 11:26:11 +01:00
|
|
|
|
2017-08-25 13:03:53 +01:00
|
|
|
/** Maximum length of a n!u\@h mask */
|
2016-07-22 11:26:11 +01:00
|
|
|
size_t GetMaxMask() const { return NickMax + 1 + IdentMax + 1 + MaxHost; }
|
2008-05-25 17:30:43 +00:00
|
|
|
};
|
|
|
|
|
2009-10-21 23:46:24 +00:00
|
|
|
struct CommandLineConf
|
|
|
|
{
|
|
|
|
/** If this value is true, the owner of the
|
|
|
|
* server specified -nofork on the command
|
|
|
|
* line, causing the daemon to stay in the
|
|
|
|
* foreground.
|
|
|
|
*/
|
|
|
|
bool nofork;
|
|
|
|
|
|
|
|
/** If this value if true then all log
|
|
|
|
* messages will be output, regardless of
|
|
|
|
* the level given in the config file.
|
|
|
|
* This is set with the -debug commandline
|
|
|
|
* option.
|
|
|
|
*/
|
|
|
|
bool forcedebug;
|
|
|
|
|
|
|
|
/** If this is true then log output will be
|
|
|
|
* written to the logfile. This is the default.
|
|
|
|
* If you put -nolog on the commandline then
|
|
|
|
* the logfile will not be written.
|
|
|
|
* This is meant to be used in conjunction with
|
|
|
|
* -debug for debugging without filling up the
|
|
|
|
* hard disk.
|
|
|
|
*/
|
|
|
|
bool writelog;
|
|
|
|
|
|
|
|
/** Saved argc from startup
|
|
|
|
*/
|
|
|
|
int argc;
|
|
|
|
|
|
|
|
/** Saved argv from startup
|
|
|
|
*/
|
|
|
|
char** argv;
|
|
|
|
};
|
|
|
|
|
2009-10-21 23:45:44 +00:00
|
|
|
class CoreExport OperInfo : public refcountbase
|
|
|
|
{
|
|
|
|
public:
|
2017-08-17 18:32:19 +01:00
|
|
|
TokenList AllowedOperCommands;
|
|
|
|
TokenList AllowedPrivs;
|
2009-10-21 23:46:05 +00:00
|
|
|
|
|
|
|
/** Allowed user modes from oper classes. */
|
|
|
|
std::bitset<64> AllowedUserModes;
|
|
|
|
|
|
|
|
/** Allowed channel modes from oper classes. */
|
|
|
|
std::bitset<64> AllowedChanModes;
|
|
|
|
|
2012-07-05 21:00:35 +01:00
|
|
|
/** \<oper> block used for this oper-up. May be NULL. */
|
2009-10-21 23:45:44 +00:00
|
|
|
reference<ConfigTag> oper_block;
|
2012-07-05 21:00:35 +01:00
|
|
|
/** \<type> block used for this oper-up. Valid for local users, may be NULL on remote */
|
2009-10-21 23:45:44 +00:00
|
|
|
reference<ConfigTag> type_block;
|
2012-07-05 21:00:35 +01:00
|
|
|
/** \<class> blocks referenced from the \<type> block. These define individual permissions */
|
2009-10-21 23:45:44 +00:00
|
|
|
std::vector<reference<ConfigTag> > class_blocks;
|
|
|
|
/** Name of the oper type; i.e. the one shown in WHOIS */
|
|
|
|
std::string name;
|
|
|
|
|
2017-10-16 02:37:57 +01:00
|
|
|
/** Creates a new OperInfo with the specified oper type name.
|
|
|
|
* @param Name The name of the oper type.
|
|
|
|
*/
|
|
|
|
OperInfo(const std::string& Name);
|
|
|
|
|
2009-10-21 23:45:44 +00:00
|
|
|
/** Get a configuration item, searching in the oper, type, and class blocks (in that order) */
|
|
|
|
std::string getConfig(const std::string& key);
|
2009-10-21 23:46:05 +00:00
|
|
|
void init();
|
2009-10-21 23:45:44 +00:00
|
|
|
};
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** This class holds the bulk of the runtime configuration for the ircd.
|
|
|
|
* It allows for reading new config values, accessing configuration files,
|
|
|
|
* and storage of the configuration data needed to run the ircd, such as
|
|
|
|
* the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
|
|
|
|
*/
|
2009-10-18 16:01:33 +00:00
|
|
|
class CoreExport ServerConfig
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
|
|
|
private:
|
2009-08-12 18:03:52 +00:00
|
|
|
void CrossCheckOperClassType();
|
|
|
|
void CrossCheckConnectBlocks(ServerConfig* current);
|
|
|
|
|
2007-11-11 18:57:22 +00:00
|
|
|
public:
|
2013-07-10 18:11:48 +01:00
|
|
|
class ServerPaths
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Config path */
|
|
|
|
std::string Config;
|
|
|
|
|
|
|
|
/** Data path */
|
|
|
|
std::string Data;
|
|
|
|
|
|
|
|
/** Log path */
|
|
|
|
std::string Log;
|
|
|
|
|
|
|
|
/** Module path */
|
|
|
|
std::string Module;
|
|
|
|
|
2017-08-27 12:59:02 +01:00
|
|
|
ServerPaths(ConfigTag* tag);
|
2013-07-10 18:11:48 +01:00
|
|
|
|
2013-10-05 04:55:11 +01:00
|
|
|
std::string PrependConfig(const std::string& fn) const { return FileSystem::ExpandPath(Config, fn); }
|
|
|
|
std::string PrependData(const std::string& fn) const { return FileSystem::ExpandPath(Data, fn); }
|
|
|
|
std::string PrependLog(const std::string& fn) const { return FileSystem::ExpandPath(Log, fn); }
|
|
|
|
std::string PrependModule(const std::string& fn) const { return FileSystem::ExpandPath(Module, fn); }
|
2013-07-10 18:11:48 +01:00
|
|
|
};
|
2009-10-21 23:44:27 +00:00
|
|
|
|
2014-07-16 12:30:05 +02:00
|
|
|
/** Holds a complete list of all connect blocks
|
|
|
|
*/
|
|
|
|
typedef std::vector<reference<ConnectClass> > ClassVector;
|
|
|
|
|
2014-07-16 12:32:47 +02:00
|
|
|
/** Index of valid oper blocks and types
|
|
|
|
*/
|
2014-12-15 17:48:52 +01:00
|
|
|
typedef insp::flat_map<std::string, reference<OperInfo> > OperIndex;
|
2014-07-16 12:32:47 +02:00
|
|
|
|
2009-10-21 23:44:27 +00:00
|
|
|
/** Get a configuration tag
|
|
|
|
* @param tag The name of the tag to get
|
|
|
|
*/
|
2009-10-21 23:46:13 +00:00
|
|
|
ConfigTag* ConfValue(const std::string& tag);
|
|
|
|
|
|
|
|
ConfigTagList ConfTags(const std::string& tag);
|
2009-10-21 23:44:27 +00:00
|
|
|
|
2014-10-08 16:34:37 +01:00
|
|
|
/** An empty configuration tag. */
|
|
|
|
ConfigTag* EmptyTag;
|
|
|
|
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Error stream, contains error output from any failed configuration parsing.
|
|
|
|
*/
|
2009-07-01 22:55:54 +00:00
|
|
|
std::stringstream errstr;
|
2007-11-11 23:09:09 +00:00
|
|
|
|
2009-07-01 22:55:46 +00:00
|
|
|
/** True if this configuration is valid enough to run with */
|
|
|
|
bool valid;
|
2007-11-11 23:09:09 +00:00
|
|
|
|
2010-02-23 18:45:26 +00:00
|
|
|
/** Bind to IPv6 by default */
|
|
|
|
bool WildcardIPv6;
|
|
|
|
|
2007-08-26 20:43:15 +00:00
|
|
|
/** Used to indicate who we announce invites to on a channel */
|
2007-08-26 21:15:47 +00:00
|
|
|
enum InviteAnnounceState { INVITE_ANNOUNCE_NONE, INVITE_ANNOUNCE_ALL, INVITE_ANNOUNCE_OPS, INVITE_ANNOUNCE_DYNAMIC };
|
2010-12-23 14:50:11 -05:00
|
|
|
enum OperSpyWhoisState { SPYWHOIS_NONE, SPYWHOIS_SINGLEMSG, SPYWHOIS_SPLITMSG };
|
2007-08-26 20:43:15 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** This holds all the information in the config file,
|
|
|
|
* it's indexed by tag name to a vector of key/values.
|
|
|
|
*/
|
|
|
|
ConfigDataHash config_data;
|
|
|
|
|
2010-02-02 16:47:25 +00:00
|
|
|
/** This holds all extra files that have been read in the configuration
|
|
|
|
* (for example, MOTD and RULES files are stored here)
|
|
|
|
*/
|
|
|
|
ConfigFileCache Files;
|
|
|
|
|
2008-09-20 20:53:04 +00:00
|
|
|
/** Length limits, see definition of ServerLimits class
|
|
|
|
*/
|
2008-05-25 17:30:43 +00:00
|
|
|
ServerLimits Limits;
|
|
|
|
|
2013-07-10 18:11:48 +01:00
|
|
|
/** Locations of various types of file (config, module, etc). */
|
|
|
|
ServerPaths Paths;
|
|
|
|
|
2009-10-21 23:46:24 +00:00
|
|
|
/** Configuration parsed from the command line.
|
|
|
|
*/
|
|
|
|
CommandLineConf cmdline;
|
|
|
|
|
2008-07-12 13:58:37 +00:00
|
|
|
/** Clones CIDR range for ipv4 (0-32)
|
|
|
|
* Defaults to 32 (checks clones on all IPs seperately)
|
|
|
|
*/
|
|
|
|
int c_ipv4_range;
|
|
|
|
|
|
|
|
/** Clones CIDR range for ipv6 (0-128)
|
|
|
|
* Defaults to 128 (checks on all IPs seperately)
|
|
|
|
*/
|
|
|
|
int c_ipv6_range;
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** Holds the server name of the local server
|
|
|
|
* as defined by the administrator.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string ServerName;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2013-07-10 14:50:26 +01:00
|
|
|
/** Notice to give to users when they are banned by an XLine
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
2013-07-10 14:50:26 +01:00
|
|
|
std::string XLineMessage;
|
2009-02-14 21:14:36 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/* Holds the network name the local server
|
|
|
|
* belongs to. This is an arbitary field defined
|
|
|
|
* by the administrator.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string Network;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/** Holds the description of the local server
|
|
|
|
* as defined by the administrator.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string ServerDesc;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2008-08-27 20:19:26 +00:00
|
|
|
/** Pretend disabled commands don't exist.
|
|
|
|
*/
|
|
|
|
bool DisabledDontExist;
|
|
|
|
|
2008-07-18 15:29:58 +00:00
|
|
|
/** This variable identifies which usermodes have been diabled.
|
|
|
|
*/
|
2017-09-11 15:38:26 +01:00
|
|
|
std::bitset<64> DisabledUModes;
|
2008-07-18 15:29:58 +00:00
|
|
|
|
|
|
|
/** This variable identifies which chanmodes have been disabled.
|
|
|
|
*/
|
2017-09-11 15:38:26 +01:00
|
|
|
std::bitset<64> DisabledCModes;
|
2008-07-18 15:29:58 +00:00
|
|
|
|
2009-02-13 09:21:30 +00:00
|
|
|
/** If set to true, then all opers on this server are
|
|
|
|
* shown with a generic 'is an IRC operator' line rather
|
|
|
|
* than the oper type. Oper types are still used internally.
|
|
|
|
*/
|
|
|
|
bool GenericOper;
|
|
|
|
|
2008-11-01 23:58:33 +00:00
|
|
|
/** If this value is true, banned users (+b, not extbans) will not be able to change nick
|
|
|
|
* if banned on any channel, nor to message them.
|
|
|
|
*/
|
|
|
|
bool RestrictBannedUsers;
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** The size of the read() buffer in the user
|
|
|
|
* handling code, used to read data into a user's
|
|
|
|
* recvQ.
|
|
|
|
*/
|
|
|
|
int NetBufferSize;
|
|
|
|
|
|
|
|
/** The value to be used for listen() backlogs
|
|
|
|
* as default.
|
|
|
|
*/
|
|
|
|
int MaxConn;
|
|
|
|
|
2013-07-01 12:31:36 -07:00
|
|
|
/** If we should check for clones during CheckClass() in AddUser()
|
|
|
|
* Setting this to false allows to not trigger on maxclones for users
|
|
|
|
* that may belong to another class after DNS-lookup is complete.
|
|
|
|
* It does, however, make the server spend more time on users we may potentially not want.
|
|
|
|
*/
|
|
|
|
bool CCOnConnect;
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** The soft limit value assigned to the irc server.
|
|
|
|
* The IRC server will not allow more than this
|
|
|
|
* number of local users.
|
|
|
|
*/
|
|
|
|
unsigned int SoftLimit;
|
|
|
|
|
|
|
|
/** Maximum number of targets for a multi target command
|
|
|
|
* such as PRIVMSG or KICK
|
|
|
|
*/
|
|
|
|
unsigned int MaxTargets;
|
|
|
|
|
|
|
|
/** True if we're going to hide netsplits as *.net *.split for non-opers
|
|
|
|
*/
|
|
|
|
bool HideSplits;
|
|
|
|
|
|
|
|
/** True if we're going to hide ban reasons for non-opers (e.g. G-Lines,
|
|
|
|
* K-Lines, Z-Lines)
|
|
|
|
*/
|
|
|
|
bool HideBans;
|
|
|
|
|
|
|
|
/** Announce invites to the channel with a server notice
|
|
|
|
*/
|
2007-08-26 20:43:15 +00:00
|
|
|
InviteAnnounceState AnnounceInvites;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/** If this is enabled then operators will
|
|
|
|
* see invisible (+i) channels in /whois.
|
|
|
|
*/
|
2010-03-22 22:30:21 +00:00
|
|
|
OperSpyWhoisState OperSpyWhois;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2010-03-19 18:06:39 +00:00
|
|
|
/** True if raw I/O is being logged */
|
|
|
|
bool RawLog;
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** Set to a non-empty string to obfuscate the server name of users in WHOIS
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string HideWhoisServer;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/** Set to a non empty string to obfuscate nicknames prepended to a KILL.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string HideKillsServer;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2016-02-25 08:37:46 -05:00
|
|
|
/** Set to hide kills from clients of ulined servers in snotices.
|
|
|
|
*/
|
|
|
|
bool HideULineKills;
|
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** The full pathname and filename of the PID
|
|
|
|
* file as defined in the configuration.
|
|
|
|
*/
|
2009-08-12 18:03:52 +00:00
|
|
|
std::string PID;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/** The connect classes in use by the IRC server.
|
|
|
|
*/
|
|
|
|
ClassVector Classes;
|
|
|
|
|
|
|
|
/** STATS characters in this list are available
|
|
|
|
* only to operators.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string UserStats;
|
2009-02-14 21:14:36 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** Default channel modes
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string DefaultModes;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/** Custom version string, which if defined can replace the system info in VERSION.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string CustomVersion;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
|
|
|
/** If set to true, provide syntax hints for unknown commands
|
|
|
|
*/
|
|
|
|
bool SyntaxHints;
|
|
|
|
|
2017-07-30 17:34:05 +01:00
|
|
|
/** The name of the casemapping method used by this server.
|
|
|
|
*/
|
|
|
|
std::string CaseMapping;
|
|
|
|
|
2010-03-14 23:59:43 +00:00
|
|
|
/** If set to true, the CycleHosts mode change will be sourced from the user,
|
|
|
|
* rather than the server
|
|
|
|
*/
|
|
|
|
bool CycleHostsFromUser;
|
|
|
|
|
2012-07-05 21:00:35 +01:00
|
|
|
/** If set to true, the full nick!user\@host will be shown in the TOPIC command
|
2007-07-16 17:30:04 +00:00
|
|
|
* for who set the topic last. If false, only the nick is shown.
|
|
|
|
*/
|
|
|
|
bool FullHostInTopic;
|
|
|
|
|
2013-08-13 14:22:07 +02:00
|
|
|
/** Oper blocks keyed by their name
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
2009-10-21 23:45:44 +00:00
|
|
|
OperIndex oper_blocks;
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2013-08-13 14:22:07 +02:00
|
|
|
/** Oper types keyed by their name
|
|
|
|
*/
|
|
|
|
OperIndex OperTypes;
|
|
|
|
|
2016-09-02 21:51:19 +02:00
|
|
|
/** Default value for <connect:maxchans>, deprecated in 3.0
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
|
|
|
unsigned int MaxChans;
|
|
|
|
|
2016-09-02 21:51:19 +02:00
|
|
|
/** Default value for <oper:maxchans>, deprecated in 3.0
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
|
|
|
unsigned int OperMaxChans;
|
|
|
|
|
2007-08-27 19:56:38 +00:00
|
|
|
/** TS6-like server ID.
|
|
|
|
* NOTE: 000...999 are usable for InspIRCd servers. This
|
|
|
|
* makes code simpler. 0AA, 1BB etc with letters are reserved
|
|
|
|
* for services use.
|
|
|
|
*/
|
2009-10-03 01:52:59 +00:00
|
|
|
std::string sid;
|
2007-08-27 19:56:38 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** Construct a new ServerConfig
|
|
|
|
*/
|
2009-09-26 14:13:13 +00:00
|
|
|
ServerConfig();
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2014-10-08 16:34:37 +01:00
|
|
|
~ServerConfig();
|
|
|
|
|
2007-08-28 18:02:01 +00:00
|
|
|
/** Get server ID as string with required leading zeroes
|
|
|
|
*/
|
2013-06-02 00:28:55 +02:00
|
|
|
const std::string& GetSID() const { return sid; }
|
2007-08-28 18:02:01 +00:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
/** Read the entire configuration into memory
|
|
|
|
* and initialize this class. All other methods
|
|
|
|
* should be used only by the core.
|
|
|
|
*/
|
2009-07-01 22:55:46 +00:00
|
|
|
void Read();
|
|
|
|
|
|
|
|
/** Apply configuration changes from the old configuration.
|
|
|
|
*/
|
|
|
|
void Apply(ServerConfig* old, const std::string &useruid);
|
2009-08-12 18:03:52 +00:00
|
|
|
void ApplyModules(User* user);
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2009-10-17 02:14:44 +00:00
|
|
|
void Fill();
|
|
|
|
|
2017-10-16 04:14:37 +01:00
|
|
|
/** Disables the commands specified in <disabled:commands>. */
|
|
|
|
bool ApplyDisabledCommands();
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2013-05-17 02:03:16 +01:00
|
|
|
/** Escapes a value for storage in a configuration key.
|
|
|
|
* @param str The string to escape.
|
|
|
|
* @param xml Are we using the XML config format?
|
|
|
|
*/
|
|
|
|
static std::string Escape(const std::string& str, bool xml = true);
|
2008-08-07 16:35:58 +00:00
|
|
|
|
2012-04-15 10:45:34 +02:00
|
|
|
/** If this value is true, snotices will not stack when repeats are sent
|
|
|
|
*/
|
|
|
|
bool NoSnoticeStack;
|
2007-07-16 17:30:04 +00:00
|
|
|
};
|
2009-10-21 23:46:13 +00:00
|
|
|
|
2009-10-25 15:21:45 +00:00
|
|
|
/** The background thread for config reading, so that reading from executable includes
|
|
|
|
* does not block.
|
|
|
|
*/
|
|
|
|
class CoreExport ConfigReaderThread : public Thread
|
|
|
|
{
|
|
|
|
ServerConfig* Config;
|
|
|
|
volatile bool done;
|
|
|
|
public:
|
|
|
|
const std::string TheUserUID;
|
|
|
|
ConfigReaderThread(const std::string &useruid)
|
|
|
|
: Config(new ServerConfig), done(false), TheUserUID(useruid)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~ConfigReaderThread()
|
|
|
|
{
|
|
|
|
delete Config;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Run();
|
|
|
|
/** Run in the main thread to apply the configuration */
|
|
|
|
void Finish();
|
|
|
|
bool IsDone() { return done; }
|
|
|
|
};
|
2013-08-16 12:10:55 +02:00
|
|
|
|
|
|
|
class CoreExport ConfigStatus
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
User* const srcuser;
|
|
|
|
|
|
|
|
ConfigStatus(User* user = NULL)
|
|
|
|
: srcuser(user)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|