summaryrefslogtreecommitdiff
path: root/include/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/config.h')
-rw-r--r--include/config.h98
1 files changed, 67 insertions, 31 deletions
diff --git a/include/config.h b/include/config.h
index e59bd6a85..25c8f6166 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1,28 +1,32 @@
/*
+ * Anope IRC Services
*
- * (C) 2003-2016 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2003-2016 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * This file is part of Anope. Anope 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.
*
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
+ * 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 see <http://www.gnu.org/licenses/>.
*/
-#ifndef CONFIG_H
-#define CONFIG_H
+#pragma once
-#include "account.h"
-#include "regchannel.h"
#include "users.h"
#include "opertype.h"
-#include <stack>
namespace Configuration
{
class CoreExport Block
{
- friend struct Conf;
+ friend class Conf;
public:
typedef Anope::map<Anope::string> item_map;
@@ -38,7 +42,8 @@ namespace Configuration
Block(const Anope::string &);
const Anope::string &GetName() const;
int CountBlock(const Anope::string &name);
- Block* GetBlock(const Anope::string &name, int num = 0);
+ Block* GetBlock(const Anope::string &name);
+ Block* GetBlock(const Anope::string &name, int num);
template<typename T> inline T Get(const Anope::string &tag)
{
@@ -49,7 +54,7 @@ namespace Configuration
*/
template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const
{
- const Anope::string &value = this->Get<const Anope::string>(tag, def);
+ const Anope::string &value = this->Get<Anope::string>(tag, def);
if (!value.empty())
try
{
@@ -59,13 +64,20 @@ namespace Configuration
return T();
}
- bool Set(const Anope::string &tag, const Anope::string &value);
+ template<typename T> void Set(const Anope::string &tag, const T &value)
+ {
+ Set(tag, stringify(value));
+ }
+
const item_map* GetItems() const;
};
- template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
+ template<> CoreExport Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const;
template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const;
+ template<> CoreExport unsigned int Block::Get(const Anope::string &tag, const Anope::string &def) const;
+
+ template<> void Block::Set(const Anope::string &tag, const Anope::string &value);
/** Represents a configuration file
*/
@@ -87,9 +99,12 @@ namespace Configuration
};
struct Uplink;
+ struct Usermode;
+ struct Channelmode;
- struct CoreExport Conf : Block
+ class CoreExport Conf : public Block
{
+ public:
/* options:readtimeout */
time_t ReadTimeout;
/* options:useprivmsg */
@@ -102,6 +117,8 @@ namespace Configuration
time_t TimeoutCheck;
/* options:usestrictprivmsg */
bool UseStrictPrivmsg;
+ /* flag for options:regexengine */
+ std::regex::flag_type regex_flags;
/* networkinfo:nickchars */
Anope::string NickChars;
@@ -115,14 +132,20 @@ namespace Configuration
std::vector<Anope::string> Ulines;
/* List of available opertypes */
std::vector<OperType *> MyOperTypes;
- /* List of pairs of opers and their opertype from the config */
- std::vector<Oper *> Opers;
+ /* names of opers configured in the configuration */
+ std::vector<Anope::string> Opers;
/* Map of fantasy commands */
CommandInfo::map Fantasy;
/* Command groups */
std::vector<CommandGroup> CommandGroups;
/* List of modules to autoload */
std::vector<Anope::string> ModulesAutoLoad;
+ /* After how many characters do we wrap lines? */
+ unsigned int LineWrap;
+ std::vector<Usermode> Usermodes;
+ std::vector<Channelmode> Channelmodes;
+ unsigned char CaseMapUpper[256] = { 0 }, CaseMapLower[256] = { 0 };
+ std::locale *locale = nullptr;
/* module configuration blocks */
std::map<Anope::string, Block *> modules;
@@ -137,9 +160,14 @@ namespace Configuration
Block *GetModule(Module *);
Block *GetModule(const Anope::string &name);
- BotInfo *GetClient(const Anope::string &name);
+ ServiceBot *GetClient(const Anope::string &name);
Block *GetCommand(CommandSource &);
+
+ void LoadBots();
+ void ApplyBots();
+
+ void LoadOpers();
};
struct Uplink
@@ -153,14 +181,26 @@ namespace Configuration
inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && ipv6 == other.ipv6; }
inline bool operator!=(const Uplink &other) const { return !(*this == other); }
};
+
+ struct Usermode
+ {
+ Anope::string name;
+ char character;
+ bool param;
+ bool oper_only, setable;
+ };
+
+ struct Channelmode
+ {
+ Anope::string name, param_regex;
+ char character;
+ char status; /* status char, if any +/@ */
+ int level; /* relative level */
+ bool oper_only, list, param, param_unset, setable;
+
+ };
}
-/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
- * When a module whishes to abort, e.g. within a constructor, it should throw an exception using ModuleException or
- * a class derived from ModuleException. If a module throws an exception during its constructor, the module will not
- * be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
- * attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
- */
class ConfigException : public CoreException
{
public:
@@ -170,14 +210,10 @@ class ConfigException : public CoreException
/** This constructor can be used to specify an error message before throwing.
*/
ConfigException(const Anope::string &message) : CoreException(message, "Config Parser") { }
- /** This destructor solves world hunger, cancels the world debt, and causes the world to end.
- * Actually no, it does nothing. Never mind.
- * @throws Nothing!
- */
- virtual ~ConfigException() throw() { }
+
+ virtual ~ConfigException() throw() = default;
};
extern Configuration::File ServicesConf;
extern CoreExport Configuration::Conf *Config;
-#endif // CONFIG_H