mirror of
https://github.com/anope/anope.git
synced 2026-07-01 23:26:38 +02:00
Return references instead of pointers from the config system.
We used to return NULL from these methods but now we return an empty block so this can never actually be null now.
This commit is contained in:
+4
-4
@@ -41,7 +41,7 @@ namespace Configuration
|
||||
Block(const Anope::string &);
|
||||
const Anope::string &GetName() const;
|
||||
int CountBlock(const Anope::string &name) const;
|
||||
const Block *GetBlock(const Anope::string &name, int num = 0) const;
|
||||
const Block &GetBlock(const Anope::string &name, int num = 0) const;
|
||||
Block *GetMutableBlock(const Anope::string &name, int num = 0);
|
||||
|
||||
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") const
|
||||
@@ -126,12 +126,12 @@ namespace Configuration
|
||||
void LoadConf(File &file);
|
||||
void Post(Conf *old);
|
||||
|
||||
Block *GetModule(const Module *);
|
||||
Block *GetModule(const Anope::string &name);
|
||||
Block &GetModule(const Module *);
|
||||
Block &GetModule(const Anope::string &name);
|
||||
|
||||
BotInfo *GetClient(const Anope::string &name);
|
||||
|
||||
const Block *GetCommand(CommandSource &);
|
||||
const Block &GetCommand(CommandSource &);
|
||||
};
|
||||
|
||||
struct Uplink final
|
||||
|
||||
+1
-1
@@ -305,7 +305,7 @@ public:
|
||||
* @param conf The config that is being built now and will replace the global Config object
|
||||
* @throws A ConfigException to abort the config (re)loading process.
|
||||
*/
|
||||
virtual void OnReload(Configuration::Conf *conf) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
|
||||
virtual void OnReload(Configuration::Conf &conf) { throw NotImplementedException(); }
|
||||
|
||||
/** Called before a bot is assigned to a channel.
|
||||
* @param sender The user assigning the bot
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace SASL
|
||||
if (!na || na->nc->HasExt("NS_SUSPENDED") || na->nc->HasExt("UNCONFIRMED"))
|
||||
return OnFail();
|
||||
|
||||
unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
|
||||
unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
|
||||
if (maxlogins && na->nc->users.size() >= maxlogins)
|
||||
return OnFail();
|
||||
|
||||
|
||||
+15
-15
@@ -23,9 +23,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const Anope::string &bsnick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const Anope::string &bsnick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
BotServ = BotInfo::Find(bsnick, true);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
/* Do not allow removing bot modes on our service bots */
|
||||
if (chan->ci && chan->ci->bi == user)
|
||||
{
|
||||
const Anope::string &botmodes = Config->GetModule(this)->Get<const Anope::string>("botmodes");
|
||||
const Anope::string &botmodes = Config->GetModule(this).Get<const Anope::string>("botmodes");
|
||||
for (auto botmode : botmodes)
|
||||
chan->SetMode(chan->ci->bi, ModeManager::FindChannelModeByChar(botmode), chan->ci->bi->GetUID());
|
||||
}
|
||||
@@ -42,9 +42,9 @@ public:
|
||||
|
||||
void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) override
|
||||
{
|
||||
if (ci->c && ci->c->users.size() >= Config->GetModule(this)->Get<unsigned>("minusers"))
|
||||
if (ci->c && ci->c->users.size() >= Config->GetModule(this).Get<unsigned>("minusers"))
|
||||
{
|
||||
ChannelStatus status(Config->GetModule(this)->Get<const Anope::string>("botmodes"));
|
||||
ChannelStatus status(Config->GetModule(this).Get<const Anope::string>("botmodes"));
|
||||
bi->Join(ci->c, &status);
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
return;
|
||||
|
||||
BotInfo *bi = user->server == Me ? dynamic_cast<BotInfo *>(user) : NULL;
|
||||
if (bi && Config->GetModule(this)->Get<bool>("smartjoin"))
|
||||
if (bi && Config->GetModule(this).Get<bool>("smartjoin"))
|
||||
{
|
||||
if (IRCD->CanClearBans)
|
||||
{
|
||||
@@ -99,9 +99,9 @@ public:
|
||||
* legit users - Rob
|
||||
**/
|
||||
/* This is before the user has joined the channel, so check usercount + 1 */
|
||||
if (c->users.size() + 1 >= Config->GetModule(this)->Get<unsigned>("minusers") && !c->FindUser(c->ci->bi))
|
||||
if (c->users.size() + 1 >= Config->GetModule(this).Get<unsigned>("minusers") && !c->FindUser(c->ci->bi))
|
||||
{
|
||||
ChannelStatus status(Config->GetModule(this)->Get<const Anope::string>("botmodes"));
|
||||
ChannelStatus status(Config->GetModule(this).Get<const Anope::string>("botmodes"));
|
||||
c->ci->bi->Join(c, &status);
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
return;
|
||||
|
||||
/* This is called prior to removing the user from the channel, so c->users.size() - 1 should be safe */
|
||||
if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this)->Get<unsigned>("minusers") && c->FindUser(c->ci->bi))
|
||||
if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this).Get<unsigned>("minusers") && c->FindUser(c->ci->bi))
|
||||
c->ci->bi->Part(c->ci->c);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
"channel, and provide a more convenient way to execute commands. Commands that\n"
|
||||
"require a channel as a parameter will automatically have that parameter\n"
|
||||
"given.\n"), source.service->nick.c_str());
|
||||
const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get<const Anope::string>("fantasycharacter", "!");
|
||||
const Anope::string &fantasycharacters = Config->GetModule("fantasy").Get<const Anope::string>("fantasycharacter", "!");
|
||||
if (!fantasycharacters.empty())
|
||||
source.Reply(_(" \n"
|
||||
"Fantasy commands may be prefixed with one of the following characters: %s\n"), fantasycharacters.c_str());
|
||||
@@ -170,8 +170,8 @@ public:
|
||||
|
||||
source.Reply(_(" \n"
|
||||
"Bot will join a channel whenever there is at least\n"
|
||||
"\002%d\002 user(s) on it."), Config->GetModule(this)->Get<unsigned>("minusers"));
|
||||
const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get<const Anope::string>("fantasycharacter", "!");
|
||||
"\002%d\002 user(s) on it."), Config->GetModule(this).Get<unsigned>("minusers"));
|
||||
const Anope::string &fantasycharacters = Config->GetModule("fantasy").Get<const Anope::string>("fantasycharacter", "!");
|
||||
if (!fantasycharacters.empty())
|
||||
source.Reply(_("Additionally, if fantasy is enabled fantasy commands\n"
|
||||
"can be executed by prefixing the command name with\n"
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
|
||||
EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string ¶m) override
|
||||
{
|
||||
if (source.GetUser() && !source.GetBot() && Config->GetModule(this)->Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
|
||||
if (source.GetUser() && !source.GetBot() && Config->GetModule(this).Get<bool>("smartjoin") && mode->name == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
|
||||
{
|
||||
BotInfo *bi = c->ci->bi;
|
||||
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
void OnCreateChan(ChannelInfo *ci) override
|
||||
{
|
||||
/* Set default bot flags */
|
||||
spacesepstream sep(Config->GetModule(this)->Get<const Anope::string>("defaults", "greet fantasy"));
|
||||
spacesepstream sep(Config->GetModule(this).Get<const Anope::string>("defaults", "greet fantasy"));
|
||||
for (Anope::string token; sep.GetToken(token);)
|
||||
ci->Extend<bool>("BS_" + token.upper());
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
void OnCreateBot(BotInfo *bi) override
|
||||
{
|
||||
if (bi->botmodes.empty())
|
||||
bi->botmodes = Config->GetModule(this)->Get<const Anope::string>("botumodes");
|
||||
bi->botmodes = Config->GetModule(this).Get<const Anope::string>("botumodes");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
void OnChanRegistered(ChannelInfo *ci) override
|
||||
{
|
||||
const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string>("bot");
|
||||
const Anope::string &bot = Config->GetModule(this).Get<const Anope::string>("bot");
|
||||
if (bot.empty())
|
||||
return;
|
||||
|
||||
|
||||
@@ -286,14 +286,14 @@ private:
|
||||
realword = word.substr(0, pos);
|
||||
}
|
||||
|
||||
unsigned badwordsmax = Config->GetModule(this->module)->Get<unsigned>("badwordsmax");
|
||||
unsigned badwordsmax = Config->GetModule(this->module).Get<unsigned>("badwordsmax");
|
||||
if (badwords->GetBadWordCount() >= badwordsmax)
|
||||
{
|
||||
source.Reply(_("Sorry, you can only have %d bad words entries on a channel."), badwordsmax);
|
||||
return;
|
||||
}
|
||||
|
||||
bool casesensitive = Config->GetModule(this->module)->Get<bool>("casesensitive");
|
||||
bool casesensitive = Config->GetModule(this->module).Get<bool>("casesensitive");
|
||||
|
||||
for (unsigned i = 0, end = badwords->GetBadWordCount(); i < end; ++i)
|
||||
{
|
||||
|
||||
@@ -515,8 +515,8 @@ public:
|
||||
if (kd->floodsecs < 1)
|
||||
kd->floodsecs = 10;
|
||||
|
||||
if (kd->floodsecs > Config->GetModule(me)->Get<time_t>("keepdata"))
|
||||
kd->floodsecs = Config->GetModule(me)->Get<time_t>("keepdata");
|
||||
if (kd->floodsecs > Config->GetModule(me).Get<time_t>("keepdata"))
|
||||
kd->floodsecs = Config->GetModule(me).Get<time_t>("keepdata");
|
||||
|
||||
kd->flood = true;
|
||||
if (kd->ttb[TTB_FLOOD])
|
||||
@@ -913,7 +913,7 @@ public:
|
||||
|
||||
void purge()
|
||||
{
|
||||
time_t keepdata = Config->GetModule(me)->Get<time_t>("keepdata");
|
||||
time_t keepdata = Config->GetModule(me).Get<time_t>("keepdata");
|
||||
for (data_type::iterator it = data_map.begin(), it_end = data_map.end(); it != it_end;)
|
||||
{
|
||||
const Anope::string &user = it->first;
|
||||
@@ -1299,7 +1299,7 @@ public:
|
||||
|
||||
/* Normalize the buffer */
|
||||
Anope::string nbuf = Anope::NormalizeBuffer(realbuf);
|
||||
bool casesensitive = Config->GetModule("botserv")->Get<bool>("casesensitive");
|
||||
bool casesensitive = Config->GetModule("botserv").Get<bool>("casesensitive");
|
||||
|
||||
/* Normalize can return an empty string if this only contains control codes etc */
|
||||
if (badwords && !nbuf.empty())
|
||||
@@ -1368,7 +1368,7 @@ public:
|
||||
if (mustkick)
|
||||
{
|
||||
check_ban(ci, u, kd, TTB_BADWORDS);
|
||||
if (Config->GetModule(me)->Get<bool>("gentlebadwordreason"))
|
||||
if (Config->GetModule(me).Get<bool>("gentlebadwordreason"))
|
||||
bot_kick(ci, u, _("Watch your language!"));
|
||||
else
|
||||
bot_kick(ci, u, _("Don't use the word \"%s\" on this channel!"), bw->word.c_str());
|
||||
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
source.Reply(_("Configures bot options.\n"
|
||||
" \n"
|
||||
"Available options:"));
|
||||
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
|
||||
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
|
||||
Anope::string this_name = source.command;
|
||||
for (const auto &[c_name, info] : source.service->commands)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
inline static Anope::string BotModes()
|
||||
{
|
||||
return Config->GetModule("botserv")->Get<Anope::string>("botmodes",
|
||||
Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o")
|
||||
return Config->GetModule("botserv").Get<Anope::string>("botmodes",
|
||||
Config->GetModule("chanserv").Get<Anope::string>("botmodes", "o")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
* @param chan The channel
|
||||
*/
|
||||
ChanServTimer(Reference<BotInfo> &cs, ExtensibleItem<bool> &i, Module *m, Channel *chan)
|
||||
: Timer(m, Config->GetModule(m)->Get<time_t>("inhabit", "1m"))
|
||||
: Timer(m, Config->GetModule(m).Get<time_t>("inhabit", "1m"))
|
||||
, ChanServ(cs)
|
||||
, inhabit(i)
|
||||
, c(chan)
|
||||
@@ -103,9 +103,9 @@ public:
|
||||
new ChanServTimer(ChanServ, inhabit, this->owner, c);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const Anope::string &channick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const Anope::string &channick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
|
||||
if (channick.empty())
|
||||
throw ConfigException(Module::name + ": <client> must be defined");
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
|
||||
ChanServ = bi;
|
||||
|
||||
spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults);
|
||||
spacesepstream(conf.GetModule(this).Get<const Anope::string>("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults);
|
||||
if (defaults.empty())
|
||||
{
|
||||
defaults.emplace_back("KEEPTOPIC");
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
else if (defaults[0].equals_ci("none"))
|
||||
defaults.clear();
|
||||
|
||||
always_lower = conf->GetModule(this)->Get<bool>("always_lower_ts");
|
||||
always_lower = conf.GetModule(this).Get<bool>("always_lower_ts");
|
||||
}
|
||||
|
||||
void OnBotDelete(BotInfo *bi) override
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
|
||||
{
|
||||
if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER"))
|
||||
if (bi == ChanServ && Config->GetModule(this).Get<bool>("opersonly") && !u->HasMode("OPER"))
|
||||
{
|
||||
u->SendMessage(bi, ACCESS_DENIED);
|
||||
return EVENT_STOP;
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
{
|
||||
std::deque<ChannelInfo *> chans;
|
||||
nc->GetChannelReferences(chans);
|
||||
int max_reg = Config->GetModule(this)->Get<int>("maxregistered");
|
||||
int max_reg = Config->GetModule(this).Get<int>("maxregistered");
|
||||
|
||||
for (auto *ci : chans)
|
||||
{
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
{
|
||||
ci->c->RemoveMode(ci->WhoSends(), "REGISTERED", "", false);
|
||||
|
||||
const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require");
|
||||
const Anope::string &require = Config->GetModule(this).Get<const Anope::string>("require");
|
||||
if (!require.empty())
|
||||
ci->c->SetModes(ci->WhoSends(), false, "-%s", require.c_str());
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
{
|
||||
if (!params.empty() || source.c || source.service != *ChanServ)
|
||||
return;
|
||||
time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d");
|
||||
time_t chanserv_expire = Config->GetModule(this).Get<time_t>("expire", "30d");
|
||||
if (chanserv_expire >= 86400)
|
||||
source.Reply(_(" \n"
|
||||
"Note that any channel which is not used for %lu days\n"
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
else
|
||||
c->RemoveMode(c->WhoSends(), "REGISTERED", "", false);
|
||||
|
||||
const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require");
|
||||
const Anope::string &require = Config->GetModule(this).Get<const Anope::string>("require");
|
||||
if (!require.empty())
|
||||
{
|
||||
if (c->ci)
|
||||
@@ -314,8 +314,8 @@ public:
|
||||
|
||||
EventReturn OnCanSet(User *u, const ChannelMode *cm) override
|
||||
{
|
||||
if (Config->GetModule(this)->Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos
|
||||
|| Config->GetModule(this)->Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos)
|
||||
if (Config->GetModule(this).Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos
|
||||
|| Config->GetModule(this).Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos)
|
||||
return EVENT_STOP;
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
|
||||
void OnExpireTick() override
|
||||
{
|
||||
time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d");
|
||||
time_t chanserv_expire = Config->GetModule(this).Get<time_t>("expire", "30d");
|
||||
|
||||
if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly)
|
||||
return;
|
||||
@@ -467,7 +467,7 @@ public:
|
||||
if (!show_all)
|
||||
return;
|
||||
|
||||
time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "30d");
|
||||
time_t chanserv_expire = Config->GetModule(this).Get<time_t>("expire", "30d");
|
||||
if (!ci->HasExt("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->last_used != Anope::CurTime)
|
||||
info[_("Expires")] = Anope::strftime(ci->last_used + chanserv_expire, source.GetAccount());
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class CommandCSAccess final
|
||||
|
||||
if (IRCD->IsChannelValid(mask))
|
||||
{
|
||||
if (Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
|
||||
if (Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
|
||||
{
|
||||
source.Reply(_("Channels may not be on access lists."));
|
||||
return;
|
||||
@@ -158,7 +158,7 @@ class CommandCSAccess final
|
||||
{
|
||||
na = NickAlias::Find(mask);
|
||||
|
||||
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
|
||||
if (!na && Config->GetModule("chanserv").Get<bool>("disallow_hostmask_access"))
|
||||
{
|
||||
source.Reply(_("Masks and unregistered users may not be on access lists."));
|
||||
return;
|
||||
@@ -205,7 +205,7 @@ class CommandCSAccess final
|
||||
}
|
||||
}
|
||||
|
||||
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
|
||||
unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
|
||||
if (access_max && ci->GetDeepAccessCount() >= access_max)
|
||||
{
|
||||
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
|
||||
@@ -601,7 +601,7 @@ public:
|
||||
"may be a numerical level or the name of a privilege (eg AUTOOP).\n"
|
||||
"When a user joins the channel the access they receive is from the\n"
|
||||
"highest level entry in the access list."));
|
||||
if (!Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
|
||||
if (!Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
|
||||
source.Reply(_("The given mask may also be a channel, which will use the\n"
|
||||
"access list from the other channel up to the given \037level\037."));
|
||||
source.Reply(" ");
|
||||
@@ -878,21 +878,21 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
defaultLevels.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("privilege"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("privilege"); ++i)
|
||||
{
|
||||
Configuration::Block *priv = conf->GetBlock("privilege", i);
|
||||
Configuration::Block &priv = conf.GetBlock("privilege", i);
|
||||
|
||||
const Anope::string &pname = priv->Get<const Anope::string>("name");
|
||||
const Anope::string &pname = priv.Get<const Anope::string>("name");
|
||||
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(pname);
|
||||
if (p == NULL)
|
||||
continue;
|
||||
|
||||
const Anope::string &value = priv->Get<const Anope::string>("level");
|
||||
const Anope::string &value = priv.Get<const Anope::string>("level");
|
||||
if (value.empty())
|
||||
continue;
|
||||
else if (value.equals_ci("founder"))
|
||||
@@ -900,7 +900,7 @@ public:
|
||||
else if (value.equals_ci("disabled"))
|
||||
defaultLevels[p->name] = ACCESS_INVALID;
|
||||
else
|
||||
defaultLevels[p->name] = priv->Get<int16_t>("level");
|
||||
defaultLevels[p->name] = priv.Get<int16_t>("level");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class CommandCSAKick final
|
||||
const NickAlias *na = NickAlias::Find(mask);
|
||||
NickCore *nc = NULL;
|
||||
const AutoKick *akick;
|
||||
unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
|
||||
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
|
||||
|
||||
if (reason.length() > reasonmax)
|
||||
reason = reason.substr(0, reasonmax);
|
||||
@@ -170,9 +170,9 @@ class CommandCSAKick final
|
||||
}
|
||||
}
|
||||
|
||||
if (ci->GetAkickCount() >= Config->GetModule(this->owner)->Get<unsigned>("autokickmax"))
|
||||
if (ci->GetAkickCount() >= Config->GetModule(this->owner).Get<unsigned>("autokickmax"))
|
||||
{
|
||||
source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner)->Get<unsigned>("autokickmax"));
|
||||
source.Reply(_("Sorry, you can only have %d autokick masks on a channel."), Config->GetModule(this->owner).Get<unsigned>("autokickmax"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ public:
|
||||
reason = autokick->reason;
|
||||
if (reason.empty())
|
||||
{
|
||||
reason = Language::Translate(u, Config->GetModule(this)->Get<const Anope::string>("autokickreason").c_str());
|
||||
reason = Language::Translate(u, Config->GetModule(this).Get<const Anope::string>("autokickreason").c_str());
|
||||
reason = reason.replace_all_cs("%n", u->nick)
|
||||
.replace_all_cs("%c", c->name);
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
Configuration::Block *block = Config->GetCommand(source);
|
||||
const Anope::string &mode = block->Get<Anope::string>("mode", "BAN");
|
||||
Configuration::Block &block = Config->GetCommand(source);
|
||||
const Anope::string &mode = block.Get<Anope::string>("mode", "BAN");
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(mode);
|
||||
if (cm == NULL)
|
||||
return;
|
||||
@@ -107,11 +107,11 @@ public:
|
||||
reason += " " + params[3];
|
||||
}
|
||||
|
||||
unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
|
||||
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
|
||||
if (reason.length() > reasonmax)
|
||||
reason = reason.substr(0, reasonmax);
|
||||
|
||||
Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)");
|
||||
Anope::string signkickformat = Config->GetModule("chanserv").Get<Anope::string>("signkickformat", "%m (%n)");
|
||||
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
|
||||
|
||||
User *u = source.GetUser();
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
if (!c->FindUser(u2))
|
||||
return;
|
||||
|
||||
if (block->Get<bool>("kick", "yes"))
|
||||
if (block.Get<bool>("kick", "yes"))
|
||||
{
|
||||
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
|
||||
{
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
else if (uc->user->IsProtected())
|
||||
continue;
|
||||
|
||||
if (block->Get<bool>("kick", "yes"))
|
||||
if (block.Get<bool>("kick", "yes"))
|
||||
{
|
||||
++kicked;
|
||||
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSClone final
|
||||
static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
|
||||
{
|
||||
std::set<Anope::string> masks;
|
||||
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
|
||||
unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
|
||||
unsigned count = 0;
|
||||
|
||||
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
|
||||
|
||||
@@ -142,7 +142,7 @@ private:
|
||||
{
|
||||
EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg");
|
||||
|
||||
if ((*messages)->size() >= Config->GetModule(this->owner)->Get<unsigned>("maxentries"))
|
||||
if ((*messages)->size() >= Config->GetModule(this->owner).Get<unsigned>("maxentries"))
|
||||
source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str());
|
||||
else
|
||||
{
|
||||
|
||||
@@ -77,10 +77,10 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
prefix = conf->GetModule("chanstats")->Get<const Anope::string>("prefix", "anope_");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("chanstats")->Get<const Anope::string>("engine"));
|
||||
prefix = conf.GetModule("chanstats").Get<const Anope::string>("prefix", "anope_");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf.GetModule("chanstats").Get<const Anope::string>("engine"));
|
||||
}
|
||||
|
||||
SQL::Result RunQuery(const SQL::Query &query)
|
||||
|
||||
@@ -104,10 +104,10 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
prefix = conf->GetModule("chanstats")->Get<const Anope::string>("prefix", "anope_");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf->GetModule("chanstats")->Get<const Anope::string>("engine"));
|
||||
prefix = conf.GetModule("chanstats").Get<const Anope::string>("prefix", "anope_");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", conf.GetModule("chanstats").Get<const Anope::string>("engine"));
|
||||
}
|
||||
|
||||
SQL::Result RunQuery(const SQL::Query &query)
|
||||
|
||||
@@ -93,7 +93,7 @@ class CommandCSFlags final
|
||||
|
||||
if (IRCD->IsChannelValid(mask))
|
||||
{
|
||||
if (Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
|
||||
if (Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
|
||||
{
|
||||
source.Reply(_("Channels may not be on access lists."));
|
||||
return;
|
||||
@@ -116,7 +116,7 @@ class CommandCSFlags final
|
||||
else
|
||||
{
|
||||
na = NickAlias::Find(mask);
|
||||
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
|
||||
if (!na && Config->GetModule("chanserv").Get<bool>("disallow_hostmask_access"))
|
||||
{
|
||||
source.Reply(_("Masks and unregistered users may not be on access lists."));
|
||||
return;
|
||||
@@ -179,7 +179,7 @@ class CommandCSFlags final
|
||||
}
|
||||
}
|
||||
|
||||
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
|
||||
unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
|
||||
if (access_max && ci->GetDeepAccessCount() >= access_max)
|
||||
{
|
||||
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
|
||||
@@ -494,21 +494,21 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
defaultFlags.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("privilege"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("privilege"); ++i)
|
||||
{
|
||||
Configuration::Block *priv = conf->GetBlock("privilege", i);
|
||||
Configuration::Block &priv = conf.GetBlock("privilege", i);
|
||||
|
||||
const Anope::string &pname = priv->Get<const Anope::string>("name");
|
||||
const Anope::string &pname = priv.Get<const Anope::string>("name");
|
||||
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(pname);
|
||||
if (p == NULL)
|
||||
continue;
|
||||
|
||||
const Anope::string &value = priv->Get<const Anope::string>("flag");
|
||||
const Anope::string &value = priv.Get<const Anope::string>("flag");
|
||||
if (value.empty())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned reasonmax = Config->GetModule("chanserv")->Get<unsigned>("reasonmax", "200");
|
||||
unsigned reasonmax = Config->GetModule("chanserv").Get<unsigned>("reasonmax", "200");
|
||||
if (reason.length() > reasonmax)
|
||||
reason = reason.substr(0, reasonmax);
|
||||
|
||||
Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)");
|
||||
Anope::string signkickformat = Config->GetModule("chanserv").Get<Anope::string>("signkickformat", "%m (%n)");
|
||||
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
|
||||
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
}
|
||||
|
||||
Anope::string spattern = "#" + pattern;
|
||||
unsigned listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50");
|
||||
unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
|
||||
|
||||
source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str());
|
||||
|
||||
@@ -160,11 +160,11 @@ public:
|
||||
" \002LIST #51-100\002\n"
|
||||
" Lists all registered channels within the given range (51-100)."));
|
||||
|
||||
if (!Config->GetBlock("options")->Get<const Anope::string>("regexengine").empty())
|
||||
if (!Config->GetBlock("options").Get<const Anope::string>("regexengine").empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Regex matches are also supported using the %s engine.\n"
|
||||
"Enclose your pattern in // if this is desired."), Config->GetBlock("options")->Get<const Anope::string>("regexengine").c_str());
|
||||
"Enclose your pattern in // if this is desired."), Config->GetBlock("options").Get<const Anope::string>("regexengine").c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -308,20 +308,20 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
defaults.clear();
|
||||
|
||||
for (int i = 0; i < block->CountBlock("default"); ++i)
|
||||
for (int i = 0; i < block.CountBlock("default"); ++i)
|
||||
{
|
||||
Configuration::Block *def = block->GetBlock("default", i);
|
||||
Configuration::Block &def = block.GetBlock("default", i);
|
||||
|
||||
LogDefault ld;
|
||||
|
||||
ld.service = def->Get<const Anope::string>("service");
|
||||
ld.command = def->Get<const Anope::string>("command");
|
||||
ld.method = def->Get<const Anope::string>("method");
|
||||
ld.service = def.Get<const Anope::string>("service");
|
||||
ld.command = def.Get<const Anope::string>("command");
|
||||
ld.method = def.Get<const Anope::string>("method");
|
||||
|
||||
defaults.push_back(ld);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ class CommandCSMode final
|
||||
continue;
|
||||
}
|
||||
|
||||
if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "50"))
|
||||
if (modelocks->GetMLock().size() >= Config->GetModule(this->owner).Get<unsigned>("max", "50"))
|
||||
{
|
||||
source.Reply(_("The mode lock list of \002%s\002 is full."), ci->name.c_str());
|
||||
continue;
|
||||
@@ -946,22 +946,22 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
modes.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("command"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
{
|
||||
Configuration::Block *block = conf->GetBlock("command", i);
|
||||
Configuration::Block &block = conf.GetBlock("command", i);
|
||||
|
||||
const Anope::string &cname = block->Get<const Anope::string>("name"),
|
||||
&cmd = block->Get<const Anope::string>("command");
|
||||
const Anope::string &cname = block.Get<const Anope::string>("name"),
|
||||
&cmd = block.Get<const Anope::string>("command");
|
||||
|
||||
if (cname.empty() || cmd != "chanserv/modes")
|
||||
continue;
|
||||
|
||||
const Anope::string &set = block->Get<const Anope::string>("set"),
|
||||
&unset = block->Get<const Anope::string>("unset");
|
||||
const Anope::string &set = block.Get<const Anope::string>("set"),
|
||||
&unset = block.Get<const Anope::string>("unset");
|
||||
|
||||
if (set.empty() && unset.empty())
|
||||
continue;
|
||||
@@ -1024,7 +1024,7 @@ public:
|
||||
{
|
||||
ModeLocks *ml = modelocks.Require(ci);
|
||||
Anope::string mlock;
|
||||
spacesepstream sep(Config->GetModule(this)->Get<const Anope::string>("mlock", "+nt"));
|
||||
spacesepstream sep(Config->GetModule(this).Get<const Anope::string>("mlock", "+nt"));
|
||||
if (sep.GetToken(mlock))
|
||||
{
|
||||
bool add = true;
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
const Anope::string &chdesc = params.size() > 1 ? params[1] : "";
|
||||
unsigned maxregistered = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
|
||||
unsigned maxregistered = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
|
||||
|
||||
User *u = source.GetUser();
|
||||
NickCore *nc = source.nc;
|
||||
|
||||
@@ -382,15 +382,15 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
simple = conf->GetModule(this)->Get<bool>("simple");
|
||||
simple = conf.GetModule(this).Get<bool>("simple");
|
||||
}
|
||||
|
||||
void OnExpireTick() override
|
||||
{
|
||||
size_t previous_size = database.size();
|
||||
time_t purgetime = Config->GetModule(this)->Get<time_t>("purgetime");
|
||||
time_t purgetime = Config->GetModule(this).Get<time_t>("purgetime");
|
||||
if (!purgetime)
|
||||
purgetime = Anope::DoTime("30d");
|
||||
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
|
||||
|
||||
@@ -36,8 +36,8 @@ public:
|
||||
" \n"
|
||||
"Available options:"));
|
||||
Anope::string this_name = source.command;
|
||||
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
|
||||
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
|
||||
for (const auto &[c_name, info] : source.service->commands)
|
||||
{
|
||||
if (c_name.find_ci(this_name + " ") == 0)
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
}
|
||||
|
||||
NickCore *nc = na->nc;
|
||||
unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
|
||||
unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
|
||||
if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit"))
|
||||
{
|
||||
source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
|
||||
@@ -461,8 +461,8 @@ public:
|
||||
|
||||
inline static Anope::string BotModes()
|
||||
{
|
||||
return Config->GetModule("botserv")->Get<Anope::string>("botmodes",
|
||||
Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o")
|
||||
return Config->GetModule("botserv").Get<Anope::string>("botmodes",
|
||||
Config->GetModule("chanserv").Get<Anope::string>("botmodes", "o")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ public:
|
||||
"access list (with the highest access, if applicable) will\n"
|
||||
"become the new founder, but if the access list is empty, the\n"
|
||||
"channel will be dropped."));
|
||||
unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
|
||||
unsigned max_reg = Config->GetModule("chanserv").Get<unsigned>("maxregistered");
|
||||
if (max_reg)
|
||||
{
|
||||
source.Reply(" ");
|
||||
@@ -1133,14 +1133,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
persist_lower_ts = conf->GetModule(this)->Get<bool>("persist_lower_ts");
|
||||
persist_lower_ts = conf.GetModule(this).Get<bool>("persist_lower_ts");
|
||||
}
|
||||
|
||||
void OnCreateChan(ChannelInfo *ci) override
|
||||
{
|
||||
ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2");
|
||||
ci->bantype = Config->GetModule(this).Get<int>("defbantype", "2");
|
||||
}
|
||||
|
||||
void OnChannelSync(Channel *c) override
|
||||
|
||||
@@ -187,27 +187,27 @@ public:
|
||||
delete item;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
descriptions.clear();
|
||||
numerics.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("command"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
{
|
||||
Configuration::Block *block = conf->GetBlock("command", i);
|
||||
Configuration::Block &block = conf.GetBlock("command", i);
|
||||
|
||||
if (block->Get<const Anope::string>("command") != "chanserv/set/misc")
|
||||
if (block.Get<const Anope::string>("command") != "chanserv/set/misc")
|
||||
continue;
|
||||
|
||||
Anope::string cname = block->Get<const Anope::string>("name");
|
||||
Anope::string desc = block->Get<const Anope::string>("misc_description");
|
||||
Anope::string cname = block.Get<const Anope::string>("name");
|
||||
Anope::string desc = block.Get<const Anope::string>("misc_description");
|
||||
|
||||
if (cname.empty() || desc.empty())
|
||||
continue;
|
||||
|
||||
descriptions[cname] = desc;
|
||||
|
||||
auto numeric = block->Get<unsigned>("misc_numeric");
|
||||
auto numeric = block.Get<unsigned>("misc_numeric");
|
||||
if (numeric >= 1 && numeric <= 999)
|
||||
numerics["cs_set_misc:" + GetAttribute(cname)] = numeric;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
const Anope::string &chan = params[0];
|
||||
Anope::string expiry = params[1];
|
||||
Anope::string reason = params.size() > 2 ? params[2] : "";
|
||||
time_t expiry_secs = Config->GetModule(this->owner)->Get<time_t>("suspendexpire");
|
||||
time_t expiry_secs = Config->GetModule(this->owner).Get<time_t>("suspendexpire");
|
||||
|
||||
if (!expiry.empty() && expiry[0] != '+')
|
||||
{
|
||||
@@ -233,9 +233,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Anope::string s = conf->GetModule(this)->Get<Anope::string>("show");
|
||||
Anope::string s = conf.GetModule(this).Get<Anope::string>("show");
|
||||
commasepstream(s).GetTokens(show);
|
||||
std::transform(show.begin(), show.end(), show.begin(), trim());
|
||||
}
|
||||
|
||||
+12
-12
@@ -141,7 +141,7 @@ private:
|
||||
|
||||
if (IRCD->IsChannelValid(mask))
|
||||
{
|
||||
if (Config->GetModule("chanserv")->Get<bool>("disallow_channel_access"))
|
||||
if (Config->GetModule("chanserv").Get<bool>("disallow_channel_access"))
|
||||
{
|
||||
source.Reply(_("Channels may not be on access lists."));
|
||||
return;
|
||||
@@ -164,7 +164,7 @@ private:
|
||||
else
|
||||
{
|
||||
na = NickAlias::Find(mask);
|
||||
if (!na && Config->GetModule("chanserv")->Get<bool>("disallow_hostmask_access"))
|
||||
if (!na && Config->GetModule("chanserv").Get<bool>("disallow_hostmask_access"))
|
||||
{
|
||||
source.Reply(_("Masks and unregistered users may not be on access lists."));
|
||||
return;
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
|
||||
unsigned access_max = Config->GetModule("chanserv").Get<unsigned>("accessmax", "1000");
|
||||
if (access_max && ci->GetDeepAccessCount() >= access_max)
|
||||
{
|
||||
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
|
||||
@@ -618,32 +618,32 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
order.clear();
|
||||
permissions.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("privilege"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("privilege"); ++i)
|
||||
{
|
||||
Configuration::Block *block = conf->GetBlock("privilege", i);
|
||||
const Anope::string &pname = block->Get<const Anope::string>("name");
|
||||
Configuration::Block &block = conf.GetBlock("privilege", i);
|
||||
const Anope::string &pname = block.Get<const Anope::string>("name");
|
||||
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(pname);
|
||||
if (p == NULL)
|
||||
continue;
|
||||
|
||||
const Anope::string &xop = block->Get<const Anope::string>("xop");
|
||||
const Anope::string &xop = block.Get<const Anope::string>("xop");
|
||||
if (pname.empty() || xop.empty())
|
||||
continue;
|
||||
|
||||
permissions[xop].push_back(pname);
|
||||
}
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("command"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
{
|
||||
Configuration::Block *block = conf->GetBlock("command", i);
|
||||
const Anope::string &cname = block->Get<const Anope::string>("name"),
|
||||
&cserv = block->Get<const Anope::string>("command");
|
||||
Configuration::Block &block = conf.GetBlock("command", i);
|
||||
const Anope::string &cname = block.Get<const Anope::string>("name"),
|
||||
&cserv = block.Get<const Anope::string>("command");
|
||||
if (cname.empty() || cserv != "chanserv/xop")
|
||||
continue;
|
||||
|
||||
|
||||
@@ -497,16 +497,16 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
prefix = block->Get<const Anope::string>("prefix", "anope_");
|
||||
SmileysHappy = block->Get<const Anope::string>("SmileysHappy");
|
||||
SmileysSad = block->Get<const Anope::string>("SmileysSad");
|
||||
SmileysOther = block->Get<const Anope::string>("SmileysOther");
|
||||
NSDefChanstats = block->Get<bool>("ns_def_chanstats");
|
||||
CSDefChanstats = block->Get<bool>("cs_def_chanstats");
|
||||
Anope::string engine = block->Get<const Anope::string>("engine");
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
prefix = block.Get<const Anope::string>("prefix", "anope_");
|
||||
SmileysHappy = block.Get<const Anope::string>("SmileysHappy");
|
||||
SmileysSad = block.Get<const Anope::string>("SmileysSad");
|
||||
SmileysOther = block.Get<const Anope::string>("SmileysOther");
|
||||
NSDefChanstats = block.Get<bool>("ns_def_chanstats");
|
||||
CSDefChanstats = block.Get<bool>("cs_def_chanstats");
|
||||
Anope::string engine = block.Get<const Anope::string>("engine");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine);
|
||||
if (sql)
|
||||
this->CheckTables();
|
||||
|
||||
@@ -500,7 +500,7 @@ private:
|
||||
else
|
||||
{
|
||||
// Generate a new password as we can't use the old one.
|
||||
auto maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
|
||||
auto maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
|
||||
Anope::Encrypt(Anope::Random(maxpasslen), nc->pass);
|
||||
Log(this) << "Unable to convert the password for " << nc->display << " as Anope does not support the format!";
|
||||
}
|
||||
@@ -1076,8 +1076,8 @@ private:
|
||||
if (!data->kill)
|
||||
return true; // Don't apply this.
|
||||
|
||||
auto kill = Config->GetModule("nickserv")->Get<time_t>("kill", "60s");
|
||||
auto killquick = Config->GetModule("nickserv")->Get<time_t>("killquick", "20s");
|
||||
auto kill = Config->GetModule("nickserv").Get<time_t>("kill", "60s");
|
||||
auto killquick = Config->GetModule("nickserv").Get<time_t>("killquick", "20s");
|
||||
auto secs = Anope::Convert<time_t>(value, kill);
|
||||
if (secs >= kill)
|
||||
nc->Extend<bool>("KILLPROTECT");
|
||||
@@ -1295,7 +1295,7 @@ private:
|
||||
|
||||
// If an Atheme account was awaiting confirmation but Anope is not
|
||||
// configured to use confirmation then autoconfirm it.
|
||||
const auto &nsregister = Config->GetModule("ns_register")->Get<const Anope::string>("registration");
|
||||
const auto &nsregister = Config->GetModule("ns_register").Get<const Anope::string>("registration");
|
||||
if (nsregister.equals_ci("none"))
|
||||
nc->Shrink<bool>("UNCONFIRMED");
|
||||
|
||||
@@ -1453,14 +1453,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
flags.clear();
|
||||
for (int i = 0; i < Config->CountBlock("privilege"); ++i)
|
||||
{
|
||||
Configuration::Block *priv = Config->GetBlock("privilege", i);
|
||||
const Anope::string &name = priv->Get<const Anope::string>("name");
|
||||
const Anope::string &value = priv->Get<const Anope::string>("flag");
|
||||
Configuration::Block &priv = Config->GetBlock("privilege", i);
|
||||
const Anope::string &name = priv.Get<const Anope::string>("name");
|
||||
const Anope::string &value = priv.Get<const Anope::string>("flag");
|
||||
if (!name.empty() && !value.empty())
|
||||
flags[name] = value[0];
|
||||
}
|
||||
@@ -1468,7 +1468,7 @@ public:
|
||||
|
||||
EventReturn OnLoadDatabase() override
|
||||
{
|
||||
const auto dbname = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "atheme.db"));
|
||||
const auto dbname = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "atheme.db"));
|
||||
std::ifstream fd(dbname.str());
|
||||
if (!fd.is_open())
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ class DBFlatFile final
|
||||
last_day = tm->tm_mday;
|
||||
|
||||
std::set<Anope::string> dbs;
|
||||
dbs.insert(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
|
||||
dbs.insert(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
|
||||
|
||||
for (const auto &type_order : Serialize::Type::GetTypeOrder())
|
||||
{
|
||||
@@ -135,7 +135,7 @@ class DBFlatFile final
|
||||
Anope::string err = Anope::LastError();
|
||||
Log(this) << "Unable to back up database " << db << " (" << err << ")!";
|
||||
|
||||
if (!Config->GetModule(this)->Get<bool>("nobackupokay"))
|
||||
if (!Config->GetModule(this).Get<bool>("nobackupokay"))
|
||||
{
|
||||
Anope::Quitting = true;
|
||||
Anope::QuitReason = "Unable to back up database " + db + " (" + err + ")";
|
||||
@@ -146,7 +146,7 @@ class DBFlatFile final
|
||||
|
||||
backups[db].push_back(newname);
|
||||
|
||||
unsigned keepbackups = Config->GetModule(this)->Get<unsigned>("keepbackups");
|
||||
unsigned keepbackups = Config->GetModule(this).Get<unsigned>("keepbackups");
|
||||
if (keepbackups > 0 && backups[db].size() > keepbackups)
|
||||
{
|
||||
unlink(backups[db].front().c_str());
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
|
||||
Log(this) << "Error saving databases: " << buf;
|
||||
|
||||
if (!Config->GetModule(this)->Get<bool>("nobackupokay"))
|
||||
if (!Config->GetModule(this).Get<bool>("nobackupokay"))
|
||||
Anope::Quitting = true;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
{
|
||||
std::set<Anope::string> tried_dbs;
|
||||
|
||||
const auto db_name = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
|
||||
const auto db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
|
||||
|
||||
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
|
||||
if (!fd.is_open())
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
|
||||
int i = -1;
|
||||
#ifndef _WIN32
|
||||
if (!Anope::Quitting && Config->GetModule(this)->Get<bool>("fork"))
|
||||
if (!Anope::Quitting && Config->GetModule(this).Get<bool>("fork"))
|
||||
{
|
||||
i = fork();
|
||||
if (i > 0)
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
if (s_type->GetOwner())
|
||||
db_name = Anope::ExpandData("module_" + s_type->GetOwner()->name + ".db");
|
||||
else
|
||||
db_name = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
|
||||
db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
|
||||
|
||||
std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream((db_name + ".tmp").c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
|
||||
|
||||
@@ -319,7 +319,7 @@ public:
|
||||
|
||||
for (auto &[mod, f] : databases)
|
||||
{
|
||||
const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this)->Get<const Anope::string>("database", "anope.db")));
|
||||
const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this).Get<const Anope::string>("database", "anope.db")));
|
||||
|
||||
if (!f->is_open() || !f->good())
|
||||
{
|
||||
@@ -363,7 +363,7 @@ public:
|
||||
if (stype->GetOwner())
|
||||
db_name = Anope::ExpandData("module_" + stype->GetOwner()->name + ".db");
|
||||
else
|
||||
db_name = Anope::ExpandData(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
|
||||
db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
|
||||
|
||||
std::fstream fd(db_name.c_str(), std::ios_base::in | std::ios_base::binary);
|
||||
if (!fd.is_open())
|
||||
|
||||
@@ -1296,7 +1296,7 @@ public:
|
||||
{
|
||||
|
||||
|
||||
hashm = Config->GetModule(this)->Get<const Anope::string>("hash");
|
||||
hashm = Config->GetModule(this).Get<const Anope::string>("hash");
|
||||
|
||||
if (hashm != "md5" && hashm != "oldmd5" && hashm != "sha1" && hashm != "plain" && hashm != "sha256")
|
||||
throw ModuleException("Invalid hash method");
|
||||
|
||||
@@ -171,10 +171,10 @@ public:
|
||||
this->updated_items.clear();
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
this->redis = ServiceReference<Provider>("Redis::Provider", block->Get<const Anope::string>("engine", "redis/main"));
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
this->redis = ServiceReference<Provider>("Redis::Provider", block.Get<const Anope::string>("engine", "redis/main"));
|
||||
}
|
||||
|
||||
EventReturn OnLoadDatabase() override
|
||||
|
||||
@@ -158,12 +158,12 @@ public:
|
||||
this->imported = true;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
this->sql = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine"));
|
||||
this->prefix = block->Get<const Anope::string>("prefix", "anope_db_");
|
||||
this->import = block->Get<bool>("import");
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
this->sql = ServiceReference<Provider>("SQL::Provider", block.Get<const Anope::string>("engine"));
|
||||
this->prefix = block.Get<const Anope::string>("prefix", "anope_db_");
|
||||
this->import = block.Get<bool>("import");
|
||||
}
|
||||
|
||||
void OnPostInit() override
|
||||
|
||||
@@ -37,7 +37,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Anope::CurTime - Config->GetBlock("options")->Get<time_t>("updatetimeout", "2m") > lastwarn)
|
||||
if (Anope::CurTime - Config->GetBlock("options").Get<time_t>("updatetimeout", "2m") > lastwarn)
|
||||
{
|
||||
Log() << "Unable to locate SQL reference, going to readonly...";
|
||||
Anope::ReadOnly = this->ro = true;
|
||||
@@ -138,11 +138,11 @@ public:
|
||||
init = false;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
this->SQL = ServiceReference<Provider>("SQL::Provider", block->Get<const Anope::string>("engine"));
|
||||
this->prefix = block->Get<const Anope::string>("prefix", "anope_db_");
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
this->SQL = ServiceReference<Provider>("SQL::Provider", block.Get<const Anope::string>("engine"));
|
||||
this->prefix = block.Get<const Anope::string>("prefix", "anope_db_");
|
||||
}
|
||||
|
||||
void OnSerializableConstruct(Serializable *obj) override
|
||||
|
||||
+13
-13
@@ -1045,23 +1045,23 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
|
||||
nameserver = block->Get<const Anope::string>("nameserver", "127.0.0.1");
|
||||
timeout = block->Get<time_t>("timeout", "5");
|
||||
ip = block->Get<const Anope::string>("ip", "0.0.0.0");
|
||||
port = block->Get<int>("port", "53");
|
||||
admin = block->Get<const Anope::string>("admin", "admin@example.com");
|
||||
nameservers = block->Get<const Anope::string>("nameservers", "ns1.example.com");
|
||||
refresh = block->Get<int>("refresh", "3600");
|
||||
nameserver = block.Get<const Anope::string>("nameserver", "127.0.0.1");
|
||||
timeout = block.Get<time_t>("timeout", "5");
|
||||
ip = block.Get<const Anope::string>("ip", "0.0.0.0");
|
||||
port = block.Get<int>("port", "53");
|
||||
admin = block.Get<const Anope::string>("admin", "admin@example.com");
|
||||
nameservers = block.Get<const Anope::string>("nameservers", "ns1.example.com");
|
||||
refresh = block.Get<int>("refresh", "3600");
|
||||
|
||||
for (int i = 0; i < block->CountBlock("notify"); ++i)
|
||||
for (int i = 0; i < block.CountBlock("notify"); ++i)
|
||||
{
|
||||
Configuration::Block *n = block->GetBlock("notify", i);
|
||||
Anope::string nip = n->Get<Anope::string>("ip");
|
||||
short nport = n->Get<short>("port");
|
||||
Configuration::Block &n = block.GetBlock("notify", i);
|
||||
Anope::string nip = n.Get<Anope::string>("ip");
|
||||
short nport = n.Get<short>("port");
|
||||
|
||||
notify.emplace_back(nip, nport);
|
||||
}
|
||||
|
||||
+19
-19
@@ -77,7 +77,7 @@ public:
|
||||
reason = reason.replace_all_cs("%h", user->host);
|
||||
reason = reason.replace_all_cs("%i", addr);
|
||||
reason = reason.replace_all_cs("%r", reply ? reply->reason : "");
|
||||
reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
reason = reason.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
|
||||
BotInfo *OperServ = Config->GetClient("OperServ");
|
||||
Log(creator, "dnsbl", OperServ) << user->GetMask() << " (" << addr << ") appears in " << this->blacklist.name;
|
||||
@@ -110,33 +110,33 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
this->check_on_connect = block->Get<bool>("check_on_connect");
|
||||
this->check_on_netburst = block->Get<bool>("check_on_netburst");
|
||||
this->add_to_akill = block->Get<bool>("add_to_akill", "yes");
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
this->check_on_connect = block.Get<bool>("check_on_connect");
|
||||
this->check_on_netburst = block.Get<bool>("check_on_netburst");
|
||||
this->add_to_akill = block.Get<bool>("add_to_akill", "yes");
|
||||
|
||||
this->blacklists.clear();
|
||||
for (int i = 0; i < block->CountBlock("blacklist"); ++i)
|
||||
for (int i = 0; i < block.CountBlock("blacklist"); ++i)
|
||||
{
|
||||
Configuration::Block *bl = block->GetBlock("blacklist", i);
|
||||
Configuration::Block &bl = block.GetBlock("blacklist", i);
|
||||
Blacklist blacklist;
|
||||
|
||||
blacklist.name = bl->Get<Anope::string>("name");
|
||||
blacklist.name = bl.Get<Anope::string>("name");
|
||||
if (blacklist.name.empty())
|
||||
continue;
|
||||
blacklist.bantime = bl->Get<time_t>("time", "4h");
|
||||
blacklist.reason = bl->Get<Anope::string>("reason");
|
||||
blacklist.bantime = bl.Get<time_t>("time", "4h");
|
||||
blacklist.reason = bl.Get<Anope::string>("reason");
|
||||
|
||||
for (int j = 0; j < bl->CountBlock("reply"); ++j)
|
||||
for (int j = 0; j < bl.CountBlock("reply"); ++j)
|
||||
{
|
||||
Configuration::Block *reply = bl->GetBlock("reply", j);
|
||||
Configuration::Block &reply = bl.GetBlock("reply", j);
|
||||
Blacklist::Reply r;
|
||||
|
||||
r.code = reply->Get<int>("code");
|
||||
r.reason = reply->Get<Anope::string>("reason");
|
||||
r.allow_account = reply->Get<bool>("allow_account");
|
||||
r.code = reply.Get<int>("code");
|
||||
r.reason = reply.Get<Anope::string>("reason");
|
||||
r.allow_account = reply.Get<bool>("allow_account");
|
||||
|
||||
blacklist.replies.push_back(r);
|
||||
}
|
||||
@@ -145,10 +145,10 @@ public:
|
||||
}
|
||||
|
||||
this->exempts.clear();
|
||||
for (int i = 0; i < block->CountBlock("exempt"); ++i)
|
||||
for (int i = 0; i < block.CountBlock("exempt"); ++i)
|
||||
{
|
||||
Configuration::Block *bl = block->GetBlock("exempt", i);
|
||||
this->exempts.insert(bl->Get<Anope::string>("ip"));
|
||||
Configuration::Block &bl = block.GetBlock("exempt", i);
|
||||
this->exempts.insert(bl.Get<Anope::string>("ip"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,11 +165,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
auto *block = conf->GetModule(this);
|
||||
auto &block = conf.GetModule(this);
|
||||
|
||||
auto rounds = block->Get<unsigned long>("rounds", "10");
|
||||
auto rounds = block.Get<unsigned long>("rounds", "10");
|
||||
if (rounds < 10 || rounds > 32)
|
||||
{
|
||||
Log(this) << "Bcrypt rounds MUST be between 10 and 32 inclusive; using 10 instead of " << rounds << '.';
|
||||
|
||||
@@ -126,9 +126,9 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
this->defaultprovider = GetAlgorithm(Config->GetModule(this)->Get<const Anope::string>("algorithm", "sha256"));
|
||||
this->defaultprovider = GetAlgorithm(Config->GetModule(this).Get<const Anope::string>("algorithm", "sha256"));
|
||||
}
|
||||
|
||||
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override
|
||||
|
||||
@@ -154,15 +154,15 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const auto *block = Config->GetModule(this);
|
||||
this->defaultprovider = GetAlgorithm(block->Get<const Anope::string>("algorithm", "argon2id"));
|
||||
Argon2Context::memory_cost = block->Get<uint32_t>("memory_cost", "131072");
|
||||
Argon2Context::time_cost = block->Get<uint32_t>("time_cost", "3");
|
||||
Argon2Context::parallelism = block->Get<uint32_t>("parallelism", "1");
|
||||
Argon2Context::hash_length = block->Get<uint32_t>("hash_length", "32");
|
||||
Argon2Context::salt_length = block->Get<uint32_t>("salt_length", "32");
|
||||
const auto &block = Config->GetModule(this);
|
||||
this->defaultprovider = GetAlgorithm(block.Get<const Anope::string>("algorithm", "argon2id"));
|
||||
Argon2Context::memory_cost = block.Get<uint32_t>("memory_cost", "131072");
|
||||
Argon2Context::time_cost = block.Get<uint32_t>("time_cost", "3");
|
||||
Argon2Context::parallelism = block.Get<uint32_t>("parallelism", "1");
|
||||
Argon2Context::hash_length = block.Get<uint32_t>("hash_length", "32");
|
||||
Argon2Context::salt_length = block.Get<uint32_t>("salt_length", "32");
|
||||
}
|
||||
|
||||
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) override
|
||||
|
||||
+11
-11
@@ -544,9 +544,9 @@ public:
|
||||
LDAPServices.clear();
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *config) override
|
||||
void OnReload(Configuration::Conf &config) override
|
||||
{
|
||||
Configuration::Block *conf = config->GetModule(this);
|
||||
Configuration::Block &conf = config.GetModule(this);
|
||||
|
||||
for (std::map<Anope::string, LDAPService *>::iterator it = this->LDAPServices.begin(); it != this->LDAPServices.end();)
|
||||
{
|
||||
@@ -556,11 +556,11 @@ public:
|
||||
|
||||
++it;
|
||||
|
||||
for (i = 0; i < conf->CountBlock("ldap"); ++i)
|
||||
if (conf->GetBlock("ldap", i)->Get<const Anope::string>("name", "ldap/main") == cname)
|
||||
for (i = 0; i < conf.CountBlock("ldap"); ++i)
|
||||
if (conf.GetBlock("ldap", i).Get<const Anope::string>("name", "ldap/main") == cname)
|
||||
break;
|
||||
|
||||
if (i == conf->CountBlock("ldap"))
|
||||
if (i == conf.CountBlock("ldap"))
|
||||
{
|
||||
Log(LOG_NORMAL, "ldap") << "LDAP: Removing server connection " << cname;
|
||||
|
||||
@@ -572,17 +572,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("ldap"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("ldap"); ++i)
|
||||
{
|
||||
Configuration::Block *ldap = conf->GetBlock("ldap", i);
|
||||
Configuration::Block &ldap = conf.GetBlock("ldap", i);
|
||||
|
||||
const Anope::string &connname = ldap->Get<const Anope::string>("name", "ldap/main");
|
||||
const Anope::string &connname = ldap.Get<const Anope::string>("name", "ldap/main");
|
||||
|
||||
if (this->LDAPServices.find(connname) == this->LDAPServices.end())
|
||||
{
|
||||
const Anope::string &server = ldap->Get<const Anope::string>("server", "127.0.0.1");
|
||||
const Anope::string &admin_binddn = ldap->Get<const Anope::string>("admin_binddn");
|
||||
const Anope::string &admin_password = ldap->Get<const Anope::string>("admin_password");
|
||||
const Anope::string &server = ldap.Get<const Anope::string>("server", "127.0.0.1");
|
||||
const Anope::string &admin_binddn = ldap.Get<const Anope::string>("admin_binddn");
|
||||
const Anope::string &admin_password = ldap.Get<const Anope::string>("admin_password");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
+14
-14
@@ -260,9 +260,9 @@ public:
|
||||
delete DThread;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *config = conf->GetModule(this);
|
||||
Configuration::Block &config = conf.GetModule(this);
|
||||
|
||||
for (std::map<Anope::string, MySQLService *>::iterator it = this->MySQLServices.begin(); it != this->MySQLServices.end();)
|
||||
{
|
||||
@@ -272,11 +272,11 @@ public:
|
||||
|
||||
++it;
|
||||
|
||||
for (i = 0; i < config->CountBlock("mysql"); ++i)
|
||||
if (config->GetBlock("mysql", i)->Get<const Anope::string>("name", "mysql/main") == cname)
|
||||
for (i = 0; i < Config->CountBlock("mysql"); ++i)
|
||||
if (config.GetBlock("mysql", i).Get<const Anope::string>("name", "mysql/main") == cname)
|
||||
break;
|
||||
|
||||
if (i == config->CountBlock("mysql"))
|
||||
if (i == Config->CountBlock("mysql"))
|
||||
{
|
||||
Log(LOG_NORMAL, "mysql") << "MySQL: Removing server connection " << cname;
|
||||
|
||||
@@ -285,19 +285,19 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < config->CountBlock("mysql"); ++i)
|
||||
for (int i = 0; i < Config->CountBlock("mysql"); ++i)
|
||||
{
|
||||
Configuration::Block *block = config->GetBlock("mysql", i);
|
||||
const Anope::string &connname = block->Get<const Anope::string>("name", "mysql/main");
|
||||
Configuration::Block &block = config.GetBlock("mysql", i);
|
||||
const Anope::string &connname = block.Get<const Anope::string>("name", "mysql/main");
|
||||
|
||||
if (this->MySQLServices.find(connname) == this->MySQLServices.end())
|
||||
{
|
||||
const Anope::string &database = block->Get<const Anope::string>("database", "anope");
|
||||
const Anope::string &server = block->Get<const Anope::string>("server", "127.0.0.1");
|
||||
const Anope::string &user = block->Get<const Anope::string>("username", "anope");
|
||||
const Anope::string &password = block->Get<const Anope::string>("password");
|
||||
unsigned int port = block->Get<unsigned int>("port", "3306");
|
||||
const Anope::string &socket = block->Get<const Anope::string>("socket");
|
||||
const Anope::string &database = block.Get<const Anope::string>("database", "anope");
|
||||
const Anope::string &server = block.Get<const Anope::string>("server", "127.0.0.1");
|
||||
const Anope::string &user = block.Get<const Anope::string>("username", "anope");
|
||||
const Anope::string &password = block.Get<const Anope::string>("password");
|
||||
unsigned int port = block.Get<unsigned int>("port", "3306");
|
||||
const Anope::string &socket = block.Get<const Anope::string>("socket");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -113,9 +113,9 @@ public:
|
||||
SQLiteServices.clear();
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *config = conf->GetModule(this);
|
||||
Configuration::Block &config = conf.GetModule(this);
|
||||
|
||||
for (std::map<Anope::string, SQLiteService *>::iterator it = this->SQLiteServices.begin(); it != this->SQLiteServices.end();)
|
||||
{
|
||||
@@ -124,8 +124,8 @@ public:
|
||||
int i, num;
|
||||
++it;
|
||||
|
||||
for (i = 0, num = config->CountBlock("sqlite"); i < num; ++i)
|
||||
if (config->GetBlock("sqlite", i)->Get<const Anope::string>("name", "sqlite/main") == cname)
|
||||
for (i = 0, num = Config->CountBlock("sqlite"); i < num; ++i)
|
||||
if (config.GetBlock("sqlite", i).Get<const Anope::string>("name", "sqlite/main") == cname)
|
||||
break;
|
||||
|
||||
if (i == num)
|
||||
@@ -137,14 +137,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < config->CountBlock("sqlite"); ++i)
|
||||
for (int i = 0; i < Config->CountBlock("sqlite"); ++i)
|
||||
{
|
||||
Configuration::Block *block = config->GetBlock("sqlite", i);
|
||||
Anope::string connname = block->Get<const Anope::string>("name", "sqlite/main");
|
||||
Configuration::Block &block = config.GetBlock("sqlite", i);
|
||||
Anope::string connname = block.Get<const Anope::string>("name", "sqlite/main");
|
||||
|
||||
if (this->SQLiteServices.find(connname) == this->SQLiteServices.end())
|
||||
{
|
||||
auto database = Anope::ExpandData(block->Get<const Anope::string>("database", "anope"));
|
||||
auto database = Anope::ExpandData(block.Get<const Anope::string>("database", "anope"));
|
||||
try
|
||||
{
|
||||
auto *ss = new SQLiteService(this, connname, database);
|
||||
|
||||
@@ -327,13 +327,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *config = conf->GetModule(this);
|
||||
Configuration::Block &config = conf.GetModule(this);
|
||||
|
||||
const Anope::string certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
|
||||
const Anope::string keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
|
||||
const Anope::string dhfile = Anope::ExpandConfig(config->Get<const Anope::string>("dh", "dhparams.pem"));
|
||||
const Anope::string certfile = Anope::ExpandConfig(config.Get<const Anope::string>("cert", "fullchain.pem"));
|
||||
const Anope::string keyfile = Anope::ExpandConfig(config.Get<const Anope::string>("key", "privkey.pem"));
|
||||
const Anope::string dhfile = Anope::ExpandConfig(config.Get<const Anope::string>("dh", "dhparams.pem"));
|
||||
|
||||
CheckFile(certfile);
|
||||
CheckFile(keyfile);
|
||||
@@ -365,9 +365,9 @@ public:
|
||||
|
||||
void OnPreServerConnect() override
|
||||
{
|
||||
Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink);
|
||||
Configuration::Block &config = Config->GetBlock("uplink", Anope::CurrentUplink);
|
||||
|
||||
if (config->Get<bool>("ssl"))
|
||||
if (config.Get<bool>("ssl"))
|
||||
{
|
||||
this->service.Init(UplinkSock);
|
||||
}
|
||||
|
||||
@@ -144,12 +144,12 @@ public:
|
||||
SSL_CTX_free(server_ctx);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *config = conf->GetModule(this);
|
||||
Configuration::Block &config = conf.GetModule(this);
|
||||
|
||||
this->certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
|
||||
this->keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
|
||||
this->certfile = Anope::ExpandConfig(config.Get<const Anope::string>("cert", "fullchain.pem"));
|
||||
this->keyfile = Anope::ExpandConfig(config.Get<const Anope::string>("key", "privkey.pem"));
|
||||
|
||||
if (Anope::IsFile(this->certfile))
|
||||
{
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
}
|
||||
|
||||
// Allow disabling old versions of TLS
|
||||
if (config->Get<bool>("tlsv10", "false"))
|
||||
if (config.Get<bool>("tlsv10", "false"))
|
||||
{
|
||||
SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1);
|
||||
SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1);
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
SSL_CTX_set_options(server_ctx, SSL_OP_NO_TLSv1);
|
||||
}
|
||||
|
||||
if (config->Get<bool>("tlsv11", "true"))
|
||||
if (config.Get<bool>("tlsv11", "true"))
|
||||
{
|
||||
SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1_1);
|
||||
SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1_1);
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
SSL_CTX_set_options(server_ctx, SSL_OP_NO_TLSv1_1);
|
||||
}
|
||||
|
||||
if (config->Get<bool>("tlsv12", "true"))
|
||||
if (config.Get<bool>("tlsv12", "true"))
|
||||
{
|
||||
SSL_CTX_clear_options(client_ctx, SSL_OP_NO_TLSv1_2);
|
||||
SSL_CTX_clear_options(server_ctx, SSL_OP_NO_TLSv1_2);
|
||||
@@ -213,9 +213,9 @@ public:
|
||||
|
||||
void OnPreServerConnect() override
|
||||
{
|
||||
Configuration::Block *config = Config->GetBlock("uplink", Anope::CurrentUplink);
|
||||
Configuration::Block &config = Config->GetBlock("uplink", Anope::CurrentUplink);
|
||||
|
||||
if (config->Get<bool>("ssl"))
|
||||
if (config.Get<bool>("ssl"))
|
||||
{
|
||||
this->service.Init(UplinkSock);
|
||||
}
|
||||
|
||||
@@ -279,12 +279,12 @@ public:
|
||||
xmlrpc_term();
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
if (httpref)
|
||||
httpref->UnregisterPage(&xmlrpcinterface);
|
||||
|
||||
this->httpref = ServiceReference<HTTPProvider>("HTTPProvider", conf->GetModule(this)->Get<const Anope::string>("server", "httpd/main"));
|
||||
this->httpref = ServiceReference<HTTPProvider>("HTTPProvider", conf.GetModule(this).Get<const Anope::string>("server", "httpd/main"));
|
||||
if (!httpref)
|
||||
throw ConfigException("Unable to find http reference, is httpd loaded?");
|
||||
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ public:
|
||||
"Note that users wanting to use fantasy commands\n"
|
||||
"MUST have enough access for both the FANTASY\n"
|
||||
"privilege and the command they are executing."),
|
||||
Config->GetModule(this->owner)->Get<const Anope::string>("fantasycharacter", "!").c_str());
|
||||
Config->GetModule(this->owner).Get<const Anope::string>("fantasycharacter", "!").c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
return;
|
||||
|
||||
Anope::string normalized_param0 = Anope::NormalizeBuffer(params[0]);
|
||||
Anope::string fantasy_chars = Config->GetModule(this)->Get<Anope::string>("fantasycharacter", "!");
|
||||
Anope::string fantasy_chars = Config->GetModule(this).Get<Anope::string>("fantasycharacter", "!");
|
||||
|
||||
if (!normalized_param0.find(c->ci->bi->nick))
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
auto maxqueue = Config->GetModule(this->module)->Get<size_t>("maxqueue", "10");
|
||||
auto maxqueue = Config->GetModule(this->module).Get<size_t>("maxqueue", "10");
|
||||
if (global->CountQueue(source.nc) >= maxqueue)
|
||||
{
|
||||
source.Reply(_("You can not queue any more messages."));
|
||||
|
||||
@@ -61,9 +61,9 @@ public:
|
||||
return q->size();
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const auto glnick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const auto glnick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
if (glnick.empty())
|
||||
throw ConfigException(Module::name + ": <client> must be defined");
|
||||
|
||||
@@ -76,21 +76,21 @@ public:
|
||||
|
||||
void OnRestart() override
|
||||
{
|
||||
const auto msg = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown");
|
||||
const auto msg = Config->GetModule(this).Get<const Anope::string>("globaloncycledown");
|
||||
if (!msg.empty())
|
||||
this->SendSingle(msg, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void OnShutdown() override
|
||||
{
|
||||
const auto msg = Config->GetModule(this)->Get<const Anope::string>("globaloncycledown");
|
||||
const auto msg = Config->GetModule(this).Get<const Anope::string>("globaloncycledown");
|
||||
if (!msg.empty())
|
||||
this->SendSingle(msg, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void OnNewServer(Server *s) override
|
||||
{
|
||||
const auto msg = Config->GetModule(this)->Get<const Anope::string>("globaloncycleup");
|
||||
const auto msg = Config->GetModule(this).Get<const Anope::string>("globaloncycleup");
|
||||
if (!msg.empty() && !Me->IsSynced())
|
||||
s->Notice(global, msg);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
return false;
|
||||
|
||||
Anope::string line;
|
||||
if (source && !Config->GetModule(this)->Get<bool>("anonymousglobal"))
|
||||
if (source && !Config->GetModule(this).Get<bool>("anonymousglobal"))
|
||||
{
|
||||
// A source is available and they're not anonymous.
|
||||
line = Anope::printf("[%s] %s", source->GetNick().c_str(), message.c_str());
|
||||
|
||||
+2
-2
@@ -44,8 +44,8 @@ public:
|
||||
Anope::string source_command = source.command;
|
||||
const BotInfo *bi = source.service;
|
||||
const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands;
|
||||
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
|
||||
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
|
||||
|
||||
if (params.empty() || params[0].equals_ci("ALL"))
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelMode *mode, const Anope::string ¶m) override
|
||||
{
|
||||
if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this)->Get<const Anope::string>("helpchannel")))
|
||||
if (mode->name == "OP" && c && c->ci && c->name.equals_ci(Config->GetModule(this).Get<const Anope::string>("helpchannel")))
|
||||
{
|
||||
User *u = User::Find(param);
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ public:
|
||||
throw ModuleException("Your IRCd does not support vhosts");
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const Anope::string &hsnick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const Anope::string &hsnick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
|
||||
if (hsnick.empty())
|
||||
throw ConfigException(Module::name + ": <client> must be defined");
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override
|
||||
{
|
||||
if (mname == "OPER" && Config->GetModule(this)->Get<bool>("activate_on_deoper", "yes"))
|
||||
if (mname == "OPER" && Config->GetModule(this).Get<bool>("activate_on_deoper", "yes"))
|
||||
this->OnUserLogin(u);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
void OnSetVHost(NickAlias *na) override
|
||||
{
|
||||
if (Config->GetModule(this)->Get<bool>("activate_on_set", "yes"))
|
||||
if (Config->GetModule(this).Get<bool>("activate_on_set", "yes"))
|
||||
{
|
||||
User *u = User::Find(na->nick);
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
|
||||
void OnDeleteVHost(NickAlias *na) override
|
||||
{
|
||||
if (Config->GetModule(this)->Get<bool>("activate_on_set", "yes"))
|
||||
if (Config->GetModule(this).Get<bool>("activate_on_set", "yes"))
|
||||
{
|
||||
User *u = User::Find(na->nick);
|
||||
|
||||
|
||||
@@ -105,11 +105,11 @@ public:
|
||||
commandhsgroup.Sync(na);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
syncongroup = block->Get<bool>("syncongroup");
|
||||
synconset = block->Get<bool>("synconset");
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
syncongroup = block.Get<bool>("syncongroup");
|
||||
synconset = block.Get<bool>("synconset");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50");
|
||||
unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
|
||||
ListFormatter list(source.GetAccount());
|
||||
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Creator")).AddColumn(_("Created"));
|
||||
|
||||
|
||||
@@ -154,8 +154,8 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
time_t send_delay = Config->GetModule("memoserv")->Get<time_t>("senddelay");
|
||||
if (Config->GetModule(this->owner)->Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime)
|
||||
time_t send_delay = Config->GetModule("memoserv").Get<time_t>("senddelay");
|
||||
if (Config->GetModule(this->owner).Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime)
|
||||
{
|
||||
auto waitperiod = (u->lastmemosend + send_delay) - Anope::CurTime;
|
||||
source.Reply(_("Please wait %s before requesting a new vhost."), Anope::Duration(waitperiod, source.GetAccount()).c_str());
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
na->SetVHost(req->ident, req->host, source.GetNick(), req->time);
|
||||
FOREACH_MOD(OnSetVHost, (na));
|
||||
|
||||
if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv)
|
||||
if (Config->GetModule(this->owner).Get<bool>("memouser") && memoserv)
|
||||
memoserv->Send(source.service->nick, na->nick, _("[auto memo] Your requested vhost has been approved."), true);
|
||||
|
||||
source.Reply(_("VHost for %s has been activated."), na->nick.c_str());
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Activate the requested vhost for the given nick."));
|
||||
if (Config->GetModule(this->owner)->Get<bool>("memouser"))
|
||||
if (Config->GetModule(this->owner).Get<bool>("memouser"))
|
||||
source.Reply(_("A memo informing the user will also be sent."));
|
||||
|
||||
return true;
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
{
|
||||
na->Shrink<HostRequestImpl>("hostrequest");
|
||||
|
||||
if (Config->GetModule(this->owner)->Get<bool>("memouser") && memoserv)
|
||||
if (Config->GetModule(this->owner).Get<bool>("memouser") && memoserv)
|
||||
{
|
||||
Anope::string message;
|
||||
if (!reason.empty())
|
||||
@@ -286,7 +286,7 @@ public:
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Reject the requested vhost for the given nick."));
|
||||
if (Config->GetModule(this->owner)->Get<bool>("memouser"))
|
||||
if (Config->GetModule(this->owner).Get<bool>("memouser"))
|
||||
source.Reply(_("A memo informing the user will also be sent, which includes the reason for the rejection if supplied."));
|
||||
|
||||
return true;
|
||||
@@ -305,7 +305,7 @@ public:
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
unsigned counter = 0;
|
||||
unsigned display_counter = 0, listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax");
|
||||
unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax");
|
||||
ListFormatter list(source.GetAccount());
|
||||
|
||||
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Created"));
|
||||
@@ -380,7 +380,7 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin
|
||||
else
|
||||
host = vhost;
|
||||
|
||||
if (Config->GetModule(me)->Get<bool>("memooper") && memoserv)
|
||||
if (Config->GetModule(me).Get<bool>("memooper") && memoserv)
|
||||
{
|
||||
for (auto *o : Oper::opers)
|
||||
{
|
||||
|
||||
+11
-11
@@ -360,25 +360,25 @@ public:
|
||||
this->providers.clear();
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *config) override
|
||||
void OnReload(Configuration::Conf &config) override
|
||||
{
|
||||
Configuration::Block *conf = config->GetModule(this);
|
||||
Configuration::Block &conf = config.GetModule(this);
|
||||
std::set<Anope::string> existing;
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("httpd"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("httpd"); ++i)
|
||||
{
|
||||
Configuration::Block *block = conf->GetBlock("httpd", i);
|
||||
Configuration::Block &block = conf.GetBlock("httpd", i);
|
||||
|
||||
|
||||
const Anope::string &hname = block->Get<const Anope::string>("name", "httpd/main");
|
||||
const Anope::string &hname = block.Get<const Anope::string>("name", "httpd/main");
|
||||
existing.insert(hname);
|
||||
|
||||
Anope::string ip = block->Get<const Anope::string>("ip");
|
||||
int port = block->Get<int>("port", "8080");
|
||||
int timeout = block->Get<int>("timeout", "30");
|
||||
bool ssl = block->Get<bool>("ssl", "no");
|
||||
Anope::string ext_ip = block->Get<const Anope::string>("extforward_ip");
|
||||
Anope::string ext_header = block->Get<const Anope::string>("extforward_header");
|
||||
Anope::string ip = block.Get<const Anope::string>("ip");
|
||||
int port = block.Get<int>("port", "8080");
|
||||
int timeout = block.Get<int>("timeout", "30");
|
||||
bool ssl = block.Get<bool>("ssl", "no");
|
||||
Anope::string ext_ip = block.Get<const Anope::string>("extforward_ip");
|
||||
Anope::string ext_header = block.Get<const Anope::string>("extforward_header");
|
||||
|
||||
if (ip.empty())
|
||||
{
|
||||
|
||||
@@ -17,21 +17,21 @@ void IRC2SQL::OnShutdown()
|
||||
quitting = true;
|
||||
}
|
||||
|
||||
void IRC2SQL::OnReload(Configuration::Conf *conf)
|
||||
void IRC2SQL::OnReload(Configuration::Conf &conf)
|
||||
{
|
||||
Configuration::Block *block = Config->GetModule(this);
|
||||
prefix = block->Get<const Anope::string>("prefix", "anope_");
|
||||
GeoIPDB = block->Get<const Anope::string>("geoip_database");
|
||||
ctcpuser = block->Get<bool>("ctcpuser", "no");
|
||||
ctcpeob = block->Get<bool>("ctcpeob", "yes");
|
||||
Anope::string engine = block->Get<const Anope::string>("engine");
|
||||
Configuration::Block &block = Config->GetModule(this);
|
||||
prefix = block.Get<const Anope::string>("prefix", "anope_");
|
||||
GeoIPDB = block.Get<const Anope::string>("geoip_database");
|
||||
ctcpuser = block.Get<bool>("ctcpuser", "no");
|
||||
ctcpeob = block.Get<bool>("ctcpeob", "yes");
|
||||
Anope::string engine = block.Get<const Anope::string>("engine");
|
||||
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine);
|
||||
if (sql)
|
||||
this->CheckTables();
|
||||
else
|
||||
Log() << "IRC2SQL: no database connection to " << engine;
|
||||
|
||||
const Anope::string &snick = block->Get<const Anope::string>("client");
|
||||
const Anope::string &snick = block.Get<const Anope::string>("client");
|
||||
if (snick.empty())
|
||||
throw ConfigException(Module::name + ": <client> must be defined");
|
||||
StatServ = BotInfo::Find(snick, true);
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
}
|
||||
|
||||
void OnShutdown() override;
|
||||
void OnReload(Configuration::Conf *config) override;
|
||||
void OnReload(Configuration::Conf &config) override;
|
||||
void OnNewServer(Server *server) override;
|
||||
void OnServerQuit(Server *server) override;
|
||||
void OnUserConnect(User *u, bool &exempt) override;
|
||||
|
||||
@@ -215,23 +215,23 @@ public:
|
||||
ModuleManager::SetPriority(this, PRIORITY_FIRST);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *config) override
|
||||
void OnReload(Configuration::Conf &config) override
|
||||
{
|
||||
Configuration::Block *conf = Config->GetModule(this);
|
||||
Configuration::Block &conf = Config->GetModule(this);
|
||||
|
||||
basedn = conf->Get<const Anope::string>("basedn");
|
||||
search_filter = conf->Get<const Anope::string>("search_filter");
|
||||
object_class = conf->Get<const Anope::string>("object_class");
|
||||
username_attribute = conf->Get<const Anope::string>("username_attribute");
|
||||
this->password_attribute = conf->Get<const Anope::string>("password_attribute");
|
||||
email_attribute = conf->Get<const Anope::string>("email_attribute");
|
||||
this->disable_register_reason = conf->Get<const Anope::string>("disable_register_reason");
|
||||
this->disable_email_reason = conf->Get<const Anope::string>("disable_email_reason");
|
||||
basedn = conf.Get<const Anope::string>("basedn");
|
||||
search_filter = conf.Get<const Anope::string>("search_filter");
|
||||
object_class = conf.Get<const Anope::string>("object_class");
|
||||
username_attribute = conf.Get<const Anope::string>("username_attribute");
|
||||
this->password_attribute = conf.Get<const Anope::string>("password_attribute");
|
||||
email_attribute = conf.Get<const Anope::string>("email_attribute");
|
||||
this->disable_register_reason = conf.Get<const Anope::string>("disable_register_reason");
|
||||
this->disable_email_reason = conf.Get<const Anope::string>("disable_email_reason");
|
||||
|
||||
if (!email_attribute.empty())
|
||||
{
|
||||
/* Don't complain to users about how they need to update their email, we will do it for them */
|
||||
config->GetModule("nickserv")->Set("forceemail", "no");
|
||||
config.GetModule("nickserv").Set("forceemail", "no");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,15 +92,15 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *config = Config->GetModule(this);
|
||||
Configuration::Block &config = Config->GetModule(this);
|
||||
|
||||
this->binddn = config->Get<const Anope::string>("binddn");
|
||||
this->password = config->Get<const Anope::string>("password");
|
||||
this->basedn = config->Get<const Anope::string>("basedn");
|
||||
this->filter = config->Get<const Anope::string>("filter");
|
||||
opertype_attribute = config->Get<const Anope::string>("opertype_attribute");
|
||||
this->binddn = config.Get<const Anope::string>("binddn");
|
||||
this->password = config.Get<const Anope::string>("password");
|
||||
this->basedn = config.Get<const Anope::string>("basedn");
|
||||
this->filter = config.Get<const Anope::string>("filter");
|
||||
opertype_attribute = config.Get<const Anope::string>("opertype_attribute");
|
||||
|
||||
for (const auto *oper : my_opers)
|
||||
delete oper;
|
||||
|
||||
@@ -19,20 +19,20 @@ class MemoServCore final
|
||||
|
||||
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
|
||||
{
|
||||
Anope::string subject = Language::Translate(nc, Config->GetBlock("mail")->Get<const Anope::string>("memo_subject").c_str()),
|
||||
message = Language::Translate(nc, Config->GetBlock("mail")->Get<const Anope::string>("memo_message").c_str());
|
||||
Anope::string subject = Language::Translate(nc, Config->GetBlock("mail").Get<const Anope::string>("memo_subject").c_str()),
|
||||
message = Language::Translate(nc, Config->GetBlock("mail").Get<const Anope::string>("memo_message").c_str());
|
||||
|
||||
subject = subject.replace_all_cs("%n", nc->display);
|
||||
subject = subject.replace_all_cs("%s", m->sender);
|
||||
subject = subject.replace_all_cs("%d", Anope::ToString(mi->GetIndex(m) + 1));
|
||||
subject = subject.replace_all_cs("%t", m->text);
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
|
||||
message = message.replace_all_cs("%n", nc->display);
|
||||
message = message.replace_all_cs("%s", m->sender);
|
||||
message = message.replace_all_cs("%d", Anope::ToString(mi->GetIndex(m) + 1));
|
||||
message = message.replace_all_cs("%t", m->text);
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
|
||||
return Mail::Send(nc, subject, message);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
{
|
||||
if (!sender->HasPriv("memoserv/no-limit") && !force)
|
||||
{
|
||||
time_t send_delay = Config->GetModule("memoserv")->Get<time_t>("senddelay");
|
||||
time_t send_delay = Config->GetModule("memoserv").Get<time_t>("senddelay");
|
||||
if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime)
|
||||
return MEMO_TOO_FAST;
|
||||
else if (!mi->memomax)
|
||||
@@ -149,9 +149,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const Anope::string &msnick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const Anope::string &msnick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
|
||||
if (msnick.empty())
|
||||
throw ConfigException(Module::name + ": <client> must be defined");
|
||||
@@ -165,12 +165,12 @@ public:
|
||||
|
||||
void OnNickCoreCreate(NickCore *nc) override
|
||||
{
|
||||
nc->memos.memomax = Config->GetModule(this)->Get<int>("maxmemos");
|
||||
nc->memos.memomax = Config->GetModule(this).Get<int>("maxmemos");
|
||||
}
|
||||
|
||||
void OnCreateChan(ChannelInfo *ci) override
|
||||
{
|
||||
ci->memos.memomax = Config->GetModule(this)->Get<int>("maxmemos");
|
||||
ci->memos.memomax = Config->GetModule(this).Get<int>("maxmemos");
|
||||
}
|
||||
|
||||
void OnBotDelete(BotInfo *bi) override
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (command.equals_ci("ADD") && !param.empty())
|
||||
{
|
||||
if (mi->ignores.size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "50"))
|
||||
if (mi->ignores.size() >= Config->GetModule(this->owner).Get<unsigned>("max", "50"))
|
||||
{
|
||||
source.Reply(_("Sorry, the memo ignore list for \002%s\002 is full."), channel.c_str());
|
||||
return;
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule(this->owner)->Get<bool>("operonly") && !source.IsServicesOper())
|
||||
if (Config->GetModule(this->owner).Get<bool>("operonly") && !source.IsServicesOper())
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
else if (result == MemoServService::MEMO_TOO_FAST)
|
||||
{
|
||||
auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0;
|
||||
auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get<unsigned long>("senddelay")) - Anope::CurTime;
|
||||
auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get<unsigned long>("senddelay")) - Anope::CurTime;
|
||||
source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str());
|
||||
}
|
||||
else if (result == MemoServService::MEMO_TARGET_FULL)
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
else if (result == MemoServService::MEMO_TOO_FAST)
|
||||
{
|
||||
auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0;
|
||||
auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get<unsigned long>("senddelay")) - Anope::CurTime;
|
||||
auto waitperiod = (lastmemosend + Config->GetModule("memoserv").Get<unsigned long>("senddelay")) - Anope::CurTime;
|
||||
source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str());
|
||||
}
|
||||
else if (result == MemoServService::MEMO_TARGET_FULL)
|
||||
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
source.Reply(_("You are not permitted to change your memo limit."));
|
||||
return;
|
||||
}
|
||||
int max_memos = Config->GetModule("memoserv")->Get<int>("maxmemos");
|
||||
int max_memos = Config->GetModule("memoserv").Get<int>("maxmemos");
|
||||
limit = Anope::Convert<int16_t>(p1, -1);
|
||||
|
||||
/* The first character is a digit, but we could still go negative
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
"\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined."));
|
||||
else if (subcommand.equals_ci("LIMIT"))
|
||||
{
|
||||
int max_memos = Config->GetModule("memoserv")->Get<int>("maxmemos");
|
||||
int max_memos = Config->GetModule("memoserv").Get<int>("maxmemos");
|
||||
if (source.IsServicesOper())
|
||||
source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n"
|
||||
" \n"
|
||||
|
||||
@@ -98,7 +98,7 @@ class NickServRelease final
|
||||
|
||||
public:
|
||||
NickServRelease(Module *me, NickAlias *na, time_t delay)
|
||||
: User(na->nick, Config->GetModule(me)->Get<const Anope::string>("enforceruser", "user"), Config->GetModule(me)->Get<const Anope::string>("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL)
|
||||
: User(na->nick, Config->GetModule(me).Get<const Anope::string>("enforceruser", "user"), Config->GetModule(me).Get<const Anope::string>("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL)
|
||||
, Timer(me, delay)
|
||||
, nick(na->nick)
|
||||
{
|
||||
@@ -140,12 +140,12 @@ class NickServCore final
|
||||
{
|
||||
collided.Unset(na);
|
||||
|
||||
new NickServHeld(this, na, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m"));
|
||||
new NickServHeld(this, na, Config->GetModule(this).Get<time_t>("releasetimeout", "1m"));
|
||||
|
||||
if (IRCD->CanSVSHold)
|
||||
IRCD->SendSVSHold(na->nick, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m"));
|
||||
IRCD->SendSVSHold(na->nick, Config->GetModule(this).Get<time_t>("releasetimeout", "1m"));
|
||||
else
|
||||
new NickServRelease(this, na, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m"));
|
||||
new NickServRelease(this, na, Config->GetModule(this).Get<time_t>("releasetimeout", "1m"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
|
||||
bool IsGuestNick(const Anope::string &nick) const override
|
||||
{
|
||||
const auto guestnick = Config->GetModule(this)->Get<Anope::string>("guestnick", "Guest####");
|
||||
const auto guestnick = Config->GetModule(this).Get<Anope::string>("guestnick", "Guest####");
|
||||
if (guestnick.empty())
|
||||
return false; // No guest nick.
|
||||
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
else if (MOD_RESULT == EVENT_ALLOW)
|
||||
return;
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
return;
|
||||
|
||||
if (!na->nc->HasExt("KILL_IMMED"))
|
||||
@@ -224,13 +224,13 @@ public:
|
||||
}
|
||||
else if (na->nc->HasExt("KILL_QUICK"))
|
||||
{
|
||||
time_t killquick = Config->GetModule("nickserv")->Get<time_t>("killquick", "20s");
|
||||
time_t killquick = Config->GetModule("nickserv").Get<time_t>("killquick", "20s");
|
||||
u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(killquick, u->Account()).c_str());
|
||||
new NickServCollide(this, this, u, na, killquick);
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t kill = Config->GetModule("nickserv")->Get<time_t>("kill", "60s");
|
||||
time_t kill = Config->GetModule("nickserv").Get<time_t>("kill", "60s");
|
||||
u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(kill, u->Account()).c_str());
|
||||
new NickServCollide(this, this, u, na, kill);
|
||||
}
|
||||
@@ -241,10 +241,10 @@ public:
|
||||
void OnUserLogin(User *u) override
|
||||
{
|
||||
NickAlias *na = NickAlias::Find(u->nick);
|
||||
if (na && *na->nc == u->Account() && !Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED"))
|
||||
if (na && *na->nc == u->Account() && !Config->GetModule("nickserv").Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED"))
|
||||
u->SetMode(NickServ, "REGISTERED");
|
||||
|
||||
const Anope::string &modesonid = Config->GetModule(this)->Get<Anope::string>("modesonid");
|
||||
const Anope::string &modesonid = Config->GetModule(this).Get<Anope::string>("modesonid");
|
||||
if (!modesonid.empty())
|
||||
u->SetModes(NickServ, modesonid);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
for (auto i = 0; i < 10; ++i)
|
||||
{
|
||||
guestnick.clear();
|
||||
for (auto guestnickchr : Config->GetModule(this)->Get<Anope::string>("guestnick", "Guest####").substr(0, IRCD->MaxNick))
|
||||
for (auto guestnickchr : Config->GetModule(this).Get<Anope::string>("guestnick", "Guest####").substr(0, IRCD->MaxNick))
|
||||
{
|
||||
if (guestnickchr == '#')
|
||||
guestnick.append(Anope::ToString(abs(Anope::RandomNumber()) % 10));
|
||||
@@ -319,9 +319,9 @@ public:
|
||||
collided.Unset(na); /* clear pending collide */
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const Anope::string &nsnick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const Anope::string &nsnick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
|
||||
if (nsnick.empty())
|
||||
throw ConfigException(Module::name + ": <client> must be defined");
|
||||
@@ -332,7 +332,7 @@ public:
|
||||
|
||||
NickServ = bi;
|
||||
|
||||
spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "memo_signon memo_receive")).GetTokens(defaults);
|
||||
spacesepstream(conf.GetModule(this).Get<const Anope::string>("defaults", "memo_signon memo_receive")).GetTokens(defaults);
|
||||
if (defaults.empty())
|
||||
{
|
||||
defaults.emplace_back("MEMO_SIGNON");
|
||||
@@ -376,9 +376,9 @@ public:
|
||||
|
||||
void OnNickIdentify(User *u) override
|
||||
{
|
||||
Configuration::Block *block = Config->GetModule(this);
|
||||
Configuration::Block &block = Config->GetModule(this);
|
||||
|
||||
if (block->Get<bool>("modeonid", "yes"))
|
||||
if (block.Get<bool>("modeonid", "yes"))
|
||||
{
|
||||
for (const auto &[_, cc] : u->chans)
|
||||
{
|
||||
@@ -388,11 +388,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const Anope::string &modesonid = block->Get<const Anope::string>("modesonid");
|
||||
const Anope::string &modesonid = block.Get<const Anope::string>("modesonid");
|
||||
if (!modesonid.empty())
|
||||
u->SetModes(NickServ, modesonid);
|
||||
|
||||
if (block->Get<bool>("forceemail", "yes") && u->Account()->email.empty())
|
||||
if (block.Get<bool>("forceemail", "yes") && u->Account()->email.empty())
|
||||
{
|
||||
u->SendMessage(NickServ, _("You must now supply an email for your nick.\n"
|
||||
"This email will allow you to retrieve your password in\n"
|
||||
@@ -434,8 +434,8 @@ public:
|
||||
|
||||
const NickAlias *na = NickAlias::Find(u->nick);
|
||||
|
||||
const Anope::string &unregistered_notice = Config->GetModule(this)->Get<const Anope::string>("unregistered_notice");
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified())
|
||||
const Anope::string &unregistered_notice = Config->GetModule(this).Get<const Anope::string>("unregistered_notice");
|
||||
if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified())
|
||||
u->SendMessage(NickServ, unregistered_notice.replace_all_cs("%n", u->nick));
|
||||
else if (na && !u->IsIdentified(true))
|
||||
this->Validate(u);
|
||||
@@ -477,7 +477,7 @@ public:
|
||||
{
|
||||
/* Reset +r and re-send account (even though it really should be set at this point) */
|
||||
IRCD->SendLogin(u, na);
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED"))
|
||||
if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED"))
|
||||
u->SetMode(NickServ, "REGISTERED");
|
||||
Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display;
|
||||
}
|
||||
@@ -496,7 +496,7 @@ public:
|
||||
{
|
||||
if (!params.empty() || source.c || source.service != *NickServ)
|
||||
return EVENT_CONTINUE;
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
source.Reply(_("\002%s\002 allows you to register a nickname and\n"
|
||||
"prevent others from using it. The following\n"
|
||||
"commands allow for registration and maintenance of\n"
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
"Services Operators can also drop any nickname without needing\n"
|
||||
"to identify for the nick, and may view the access list for\n"
|
||||
"any nickname."));
|
||||
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y");
|
||||
time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y");
|
||||
if (nickserv_expire >= 86400)
|
||||
source.Reply(_(" \n"
|
||||
"Accounts that are not used anymore are subject to\n"
|
||||
@@ -538,7 +538,7 @@ public:
|
||||
|
||||
void OnUserQuit(User *u, const Anope::string &msg) override
|
||||
{
|
||||
if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this)->Get<bool>("hidenetsplitquit"))
|
||||
if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this).Get<bool>("hidenetsplitquit"))
|
||||
return;
|
||||
|
||||
/* Update last quit and last seen for the user */
|
||||
@@ -555,7 +555,7 @@ public:
|
||||
if (Anope::NoExpire || Anope::ReadOnly)
|
||||
return;
|
||||
|
||||
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d");
|
||||
time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "90d");
|
||||
|
||||
for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; )
|
||||
{
|
||||
@@ -571,7 +571,7 @@ public:
|
||||
if (nickserv_expire && Anope::CurTime - na->last_seen >= nickserv_expire)
|
||||
expire = true;
|
||||
|
||||
if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay"))
|
||||
if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get<bool>("preservedisplay"))
|
||||
expire = false;
|
||||
|
||||
FOREACH_MOD(OnPreNickExpire, (na, expire));
|
||||
@@ -589,13 +589,13 @@ public:
|
||||
{
|
||||
if (!na->nc->HasExt("UNCONFIRMED"))
|
||||
{
|
||||
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y");
|
||||
time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y");
|
||||
if (!na->HasExt("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->last_seen != Anope::CurTime))
|
||||
info[_("Expires")] = Anope::strftime(na->last_seen + nickserv_expire, source.GetAccount());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d");
|
||||
time_t unconfirmed_expire = Config->GetModule("ns_register").Get<time_t>("unconfirmedexpire", "1d");
|
||||
info[_("Expires")] = Anope::strftime(na->time_registered + unconfirmed_expire, source.GetAccount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,9 +139,9 @@ class CommandNSAJoin final
|
||||
if ((*channels)->at(i)->channel.equals_ci(chan))
|
||||
break;
|
||||
|
||||
if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"))
|
||||
if ((*channels)->size() >= Config->GetModule(this->owner).Get<unsigned>("ajoinmax"))
|
||||
{
|
||||
source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax"));
|
||||
source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner).Get<unsigned>("ajoinmax"));
|
||||
return;
|
||||
}
|
||||
else if (i != (*channels)->size())
|
||||
|
||||
@@ -204,7 +204,7 @@ private:
|
||||
void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
unsigned max = Config->GetModule(this->owner)->Get<unsigned>("max", "5");
|
||||
unsigned max = Config->GetModule(this->owner).Get<unsigned>("max", "5");
|
||||
|
||||
if (cl->GetCertCount() >= max)
|
||||
{
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
}
|
||||
else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
|
||||
else if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST"))
|
||||
{
|
||||
source.Reply(_("You may view but not modify the certificate list of other Services Operators."));
|
||||
return;
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
if (!nc || nc->HasExt("NS_SUSPENDED"))
|
||||
return;
|
||||
|
||||
unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
|
||||
unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
|
||||
if (maxlogins && nc->users.size() >= maxlogins)
|
||||
{
|
||||
u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), nc->display.c_str(), maxlogins);
|
||||
@@ -420,7 +420,7 @@ public:
|
||||
|
||||
void OnNickRegister(User *u, NickAlias *na, const Anope::string &pass) override
|
||||
{
|
||||
if (!Config->GetModule(this)->Get<bool>("automatic", "yes") || !u || u->fingerprint.empty())
|
||||
if (!Config->GetModule(this).Get<bool>("automatic", "yes") || !u || u->fingerprint.empty())
|
||||
return;
|
||||
|
||||
auto *cl = certs.Require(na->nc);
|
||||
@@ -437,7 +437,7 @@ public:
|
||||
{
|
||||
BotInfo *NickServ = Config->GetClient("NickServ");
|
||||
|
||||
unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
|
||||
unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins");
|
||||
if (maxlogins && na->nc->users.size() >= maxlogins)
|
||||
{
|
||||
u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
|
||||
|
||||
@@ -51,13 +51,13 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper())
|
||||
if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper())
|
||||
{
|
||||
source.Reply(_("You may not drop other Services Operators' nicknames."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display"))
|
||||
if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display"))
|
||||
{
|
||||
source.Reply(_("You may not drop \002%s\002 as it is the display nick for the account."), na->nick.c_str());
|
||||
return;
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("restrictopernicks"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("restrictopernicks"))
|
||||
{
|
||||
for (auto *o : Oper::opers)
|
||||
{
|
||||
@@ -151,8 +151,8 @@ public:
|
||||
}
|
||||
|
||||
NickAlias *target, *na = NickAlias::Find(source.GetNick());
|
||||
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
|
||||
unsigned maxaliases = Config->GetModule(this->owner)->Get<unsigned>("maxaliases");
|
||||
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
|
||||
unsigned maxaliases = Config->GetModule(this->owner).Get<unsigned>("maxaliases");
|
||||
if (!(target = NickAlias::Find(nick)))
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
else if (user && Anope::CurTime < user->lastnickreg + reg_delay)
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick;
|
||||
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
|
||||
}
|
||||
else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange"))
|
||||
else if (na && Config->GetModule(this->owner).Get<bool>("nogroupchange"))
|
||||
source.Reply(_("Your nick is already registered."));
|
||||
else if (na && *target->nc == *na->nc)
|
||||
source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str());
|
||||
@@ -336,8 +336,8 @@ public:
|
||||
|
||||
ListFormatter list(source.GetAccount());
|
||||
list.AddColumn(_("Nick")).AddColumn(_("Expires"));
|
||||
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "90d"),
|
||||
unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d");
|
||||
time_t nickserv_expire = Config->GetModule("nickserv").Get<time_t>("expire", "90d"),
|
||||
unconfirmed_expire = Config->GetModule("ns_register").Get<time_t>("unconfirmedexpire", "1d");
|
||||
for (auto *na2 : *nc->aliases)
|
||||
{
|
||||
Anope::string expires;
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandnsgroup(this), commandnsungroup(this), commandnsglist(this)
|
||||
{
|
||||
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int maxlogins = Config->GetModule(this->owner)->Get<unsigned int>("maxlogins");
|
||||
unsigned int maxlogins = Config->GetModule(this->owner).Get<unsigned int>("maxlogins");
|
||||
if (na && maxlogins && na->nc->users.size() >= maxlogins)
|
||||
{
|
||||
source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
bool is_servadmin = source.HasCommand("nickserv/list");
|
||||
int count = 0, from = 0, to = 0;
|
||||
bool suspended, nsnoexpire, unconfirmed;
|
||||
unsigned listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50");
|
||||
unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
|
||||
|
||||
suspended = nsnoexpire = unconfirmed = false;
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
" \002LIST #51-100\002\n"
|
||||
" Lists all registered nicks within the given range (51-100)."));
|
||||
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
|
||||
@@ -38,7 +38,7 @@ class NSMaxEmail final
|
||||
|
||||
bool CheckLimitReached(CommandSource &source, const Anope::string &email)
|
||||
{
|
||||
int NSEmailMax = Config->GetModule(this)->Get<int>("maxemails");
|
||||
int NSEmailMax = Config->GetModule(this).Get<int>("maxemails");
|
||||
|
||||
if (NSEmailMax < 1 || email.empty())
|
||||
return false;
|
||||
@@ -79,9 +79,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
clean = conf->GetModule(this)->Get<bool>("remove_aliases", "true");
|
||||
clean = conf.GetModule(this).Get<bool>("remove_aliases", "true");
|
||||
}
|
||||
|
||||
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->display;
|
||||
}
|
||||
|
||||
if (Config->GetModule("ns_recover")->Get<bool>("restoreonrecover"))
|
||||
if (Config->GetModule("ns_recover").Get<bool>("restoreonrecover"))
|
||||
{
|
||||
if (!u->chans.empty())
|
||||
{
|
||||
@@ -239,14 +239,14 @@ public:
|
||||
commandnsrecover(this), recover(this, "recover"), svsnick(this, "svsnick")
|
||||
{
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
throw ModuleException(modname + " can not be used with options:nonicknameownership enabled");
|
||||
|
||||
}
|
||||
|
||||
void OnUserNickChange(User *u, const Anope::string &oldnick) override
|
||||
{
|
||||
if (Config->GetModule(this)->Get<bool>("restoreonrecover"))
|
||||
if (Config->GetModule(this).Get<bool>("restoreonrecover"))
|
||||
{
|
||||
NSRecoverInfo *ei = recover.Get(u);
|
||||
BotInfo *NickServ = Config->GetClient("NickServ");
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
|
||||
void OnJoinChannel(User *u, Channel *c) override
|
||||
{
|
||||
if (Config->GetModule(this)->Get<bool>("restoreonrecover"))
|
||||
if (Config->GetModule(this).Get<bool>("restoreonrecover"))
|
||||
{
|
||||
NSRecoverInfo *ei = recover.Get(u);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
NickAlias *u_na = NickAlias::Find(u->nick);
|
||||
|
||||
/* Set +r if they're on a nick in the group */
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && u_na && *u_na->nc == *na->nc)
|
||||
if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && u_na && *u_na->nc == *na->nc)
|
||||
u->SetMode(source.service, "REGISTERED");
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
if (na)
|
||||
{
|
||||
IRCD->SendLogin(source.GetUser(), na);
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED"))
|
||||
if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED"))
|
||||
source.GetUser()->SetMode(source.service, "REGISTERED");
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 1, 2)
|
||||
{
|
||||
this->SetDesc(_("Register a nickname"));
|
||||
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
|
||||
this->SetSyntax(_("\037password\037 \037email\037"));
|
||||
else
|
||||
this->SetSyntax(_("\037password\037 \037[email]\037"));
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
Anope::string u_nick = source.GetNick();
|
||||
Anope::string pass = params[0];
|
||||
Anope::string email = params.size() > 1 ? params[1] : "";
|
||||
const Anope::string &nsregister = Config->GetModule(this->owner)->Get<const Anope::string>("registration");
|
||||
const Anope::string &nsregister = Config->GetModule(this->owner).Get<const Anope::string>("registration");
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
{
|
||||
@@ -151,8 +151,8 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
time_t nickregdelay = Config->GetModule(this->owner)->Get<time_t>("nickregdelay");
|
||||
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
|
||||
time_t nickregdelay = Config->GetModule(this->owner).Get<time_t>("nickregdelay");
|
||||
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
|
||||
if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay)
|
||||
{
|
||||
auto waitperiod = (u->timestamp + nickregdelay) - Anope::CurTime;
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("restrictopernicks"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("restrictopernicks"))
|
||||
{
|
||||
for (auto *o : Oper::opers)
|
||||
{
|
||||
@@ -191,10 +191,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
|
||||
unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty())
|
||||
if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes") && email.empty())
|
||||
this->OnSyntaxError(source, "");
|
||||
else if (u && Anope::CurTime < u->lastnickreg + reg_delay)
|
||||
{
|
||||
@@ -271,7 +271,7 @@ public:
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
|
||||
{
|
||||
unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
|
||||
unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Registers your nickname in the %s database. Once\n"
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
source.service->nick.c_str(), source.service->nick.c_str(),
|
||||
minpasslen);
|
||||
|
||||
if (!Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
if (!Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
|
||||
{
|
||||
source.Reply(" ");
|
||||
source.Reply(_("The \037email\037 parameter is optional and will set the email\n"
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail"))
|
||||
if (!Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
source.Reply(_("Your account is already confirmed."));
|
||||
else
|
||||
{
|
||||
if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner)->Get<time_t>("resenddelay"))
|
||||
if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner).Get<time_t>("resenddelay"))
|
||||
source.Reply(_("Cannot send mail now; please retry a little later."));
|
||||
else if (SendRegmail(source.GetUser(), na, source.service))
|
||||
{
|
||||
@@ -353,7 +353,7 @@ public:
|
||||
|
||||
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
|
||||
{
|
||||
if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail"))
|
||||
if (!Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
|
||||
return false;
|
||||
|
||||
this->SendSyntax(source);
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
|
||||
void OnServHelp(CommandSource &source) override
|
||||
{
|
||||
if (Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail"))
|
||||
if (Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
|
||||
Command::OnServHelp(source);
|
||||
}
|
||||
};
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
commandnsregister(this), commandnsconfirm(this), commandnsrsend(this), unconfirmed(this, "UNCONFIRMED"),
|
||||
passcode(this, "passcode")
|
||||
{
|
||||
if (Config->GetModule(this)->Get<const Anope::string>("registration").equals_ci("disable"))
|
||||
if (Config->GetModule(this).Get<const Anope::string>("registration").equals_ci("disable"))
|
||||
throw ModuleException("Module " + this->name + " will not load with registration disabled.");
|
||||
}
|
||||
|
||||
@@ -393,14 +393,14 @@ public:
|
||||
BotInfo *NickServ;
|
||||
if (unconfirmed.HasExt(u->Account()) && (NickServ = Config->GetClient("NickServ")))
|
||||
{
|
||||
const Anope::string &nsregister = Config->GetModule(this)->Get<const Anope::string>("registration");
|
||||
const Anope::string &nsregister = Config->GetModule(this).Get<const Anope::string>("registration");
|
||||
if (nsregister.equals_ci("admin"))
|
||||
u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed."));
|
||||
else
|
||||
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you."));
|
||||
const NickAlias *this_na = u->AccountNick();
|
||||
time_t time_registered = Anope::CurTime - this_na->time_registered;
|
||||
time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
|
||||
time_t unconfirmed_expire = Config->GetModule(this).Get<time_t>("unconfirmedexpire", "1d");
|
||||
if (unconfirmed_expire > time_registered)
|
||||
u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s."), Anope::Duration(unconfirmed_expire - time_registered, u->Account()).c_str());
|
||||
}
|
||||
@@ -410,7 +410,7 @@ public:
|
||||
{
|
||||
if (unconfirmed.HasExt(na->nc))
|
||||
{
|
||||
time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
|
||||
time_t unconfirmed_expire = Config->GetModule(this).Get<time_t>("unconfirmedexpire", "1d");
|
||||
if (unconfirmed_expire && Anope::CurTime - na->time_registered >= unconfirmed_expire)
|
||||
expire = true;
|
||||
}
|
||||
@@ -428,15 +428,15 @@ static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi)
|
||||
*code = Anope::Random(15);
|
||||
}
|
||||
|
||||
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("registration_subject").c_str()),
|
||||
message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("registration_message").c_str());
|
||||
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_subject").c_str()),
|
||||
message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_message").c_str());
|
||||
|
||||
subject = subject.replace_all_cs("%n", na->nick);
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%c", *code);
|
||||
|
||||
message = message.replace_all_cs("%n", na->nick);
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%c", *code);
|
||||
|
||||
return Mail::Send(u, nc, bi, subject, message);
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
commandnsresetpass(this), reset(this, "reset")
|
||||
{
|
||||
if (!Config->GetBlock("mail")->Get<bool>("usemail"))
|
||||
if (!Config->GetBlock("mail").Get<bool>("usemail"))
|
||||
throw ModuleException("Not using mail.");
|
||||
}
|
||||
|
||||
@@ -132,16 +132,16 @@ public:
|
||||
|
||||
static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi)
|
||||
{
|
||||
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_subject").c_str()),
|
||||
message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_message").c_str()),
|
||||
Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_subject").c_str()),
|
||||
message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_message").c_str()),
|
||||
passcode = Anope::Random(20);
|
||||
|
||||
subject = subject.replace_all_cs("%n", na->nick);
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%c", passcode);
|
||||
|
||||
message = message.replace_all_cs("%n", na->nick);
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%c", passcode);
|
||||
|
||||
ResetInfo *ri = na->nc->Extend<ResetInfo>("reset");
|
||||
|
||||
+16
-16
@@ -34,8 +34,8 @@ public:
|
||||
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
|
||||
|
||||
Anope::string this_name = source.command;
|
||||
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
|
||||
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
|
||||
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
|
||||
for (const auto &[c_name, info] : source.service->commands)
|
||||
{
|
||||
if (c_name.find_ci(this_name + " ") == 0)
|
||||
@@ -134,14 +134,14 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
|
||||
unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
|
||||
if (len < minpasslen)
|
||||
{
|
||||
source.Reply(PASSWORD_TOO_SHORT, minpasslen);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
|
||||
if (len > maxpasslen)
|
||||
{
|
||||
source.Reply(PASSWORD_TOO_LONG, maxpasslen);
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
|
||||
size_t len = params[1].length();
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
|
||||
if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
|
||||
{
|
||||
source.Reply(_("You may not change the password of other Services Operators."));
|
||||
return;
|
||||
@@ -208,14 +208,14 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10");
|
||||
unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10");
|
||||
if (len < minpasslen)
|
||||
{
|
||||
source.Reply(PASSWORD_TOO_SHORT, minpasslen);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50");
|
||||
unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50");
|
||||
if (len > maxpasslen)
|
||||
{
|
||||
source.Reply(PASSWORD_TOO_LONG, maxpasslen);
|
||||
@@ -440,7 +440,7 @@ public:
|
||||
|
||||
NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
{
|
||||
source.Reply(_("This command may not be used on this network because nickname ownership is disabled."));
|
||||
return;
|
||||
@@ -526,19 +526,19 @@ class CommandNSSetEmail
|
||||
n->first = new_email;
|
||||
n->second = code;
|
||||
|
||||
Anope::string subject = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_subject"),
|
||||
message = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_message");
|
||||
Anope::string subject = Config->GetBlock("mail").Get<const Anope::string>("emailchange_subject"),
|
||||
message = Config->GetBlock("mail").Get<const Anope::string>("emailchange_message");
|
||||
|
||||
subject = subject.replace_all_cs("%e", nc->email);
|
||||
subject = subject.replace_all_cs("%E", new_email);
|
||||
subject = subject.replace_all_cs("%n", nc->display);
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
subject = subject.replace_all_cs("%c", code);
|
||||
|
||||
message = message.replace_all_cs("%e", nc->email);
|
||||
message = message.replace_all_cs("%E", new_email);
|
||||
message = message.replace_all_cs("%n", nc->display);
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname"));
|
||||
message = message.replace_all_cs("%c", code);
|
||||
|
||||
Anope::string old = nc->email;
|
||||
@@ -577,12 +577,12 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
|
||||
if (param.empty() && Config->GetModule("nickserv").Get<bool>("forceemail", "yes"))
|
||||
{
|
||||
source.Reply(_("You cannot unset the email on this network."));
|
||||
return;
|
||||
}
|
||||
else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
|
||||
else if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
|
||||
{
|
||||
source.Reply(_("You may not change the email of other Services Operators."));
|
||||
return;
|
||||
@@ -598,8 +598,8 @@ public:
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
const auto nsmailreg = Config->GetModule("ns_register")->Get<const Anope::string>("registration").equals_ci("mail");
|
||||
if (!param.empty() && Config->GetModule("nickserv")->Get<bool>("confirmemailchanges", nsmailreg ? "yes" : "no") && !source.IsServicesOper())
|
||||
const auto nsmailreg = Config->GetModule("ns_register").Get<const Anope::string>("registration").equals_ci("mail");
|
||||
if (!param.empty() && Config->GetModule("nickserv").Get<bool>("confirmemailchanges", nsmailreg ? "yes" : "no") && !source.IsServicesOper())
|
||||
{
|
||||
if (SendConfirmMail(source.GetUser(), source.GetAccount(), source.service, param))
|
||||
{
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
{
|
||||
if (keep_modes.HasExt(u->Account()))
|
||||
{
|
||||
const auto norestore = Config->GetModule(this)->Get<const Anope::string>("norestore");
|
||||
const auto norestore = Config->GetModule(this).Get<const Anope::string>("norestore");
|
||||
User::ModeList modes = u->Account()->last_modes;
|
||||
for (const auto &[last_mode, last_value] : modes)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
{
|
||||
source.Reply(_("This command may not be used on this network because nickname ownership is disabled."));
|
||||
return;
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
}
|
||||
else if (param.equals_ci("IMMED"))
|
||||
{
|
||||
if (Config->GetModule(this->owner)->Get<bool>("allowkillimmed"))
|
||||
if (Config->GetModule(this->owner).Get<bool>("allowkillimmed"))
|
||||
{
|
||||
nc->Extend<bool>("KILLPROTECT");
|
||||
nc->Shrink<bool>("KILL_QUICK");
|
||||
|
||||
@@ -200,21 +200,21 @@ public:
|
||||
delete data;
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
descriptions.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("command"); ++i)
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
{
|
||||
Configuration::Block *block = conf->GetBlock("command", i);
|
||||
Configuration::Block &block = conf.GetBlock("command", i);
|
||||
|
||||
const Anope::string &cmd = block->Get<const Anope::string>("command");
|
||||
const Anope::string &cmd = block.Get<const Anope::string>("command");
|
||||
|
||||
if (cmd != "nickserv/set/misc" && cmd != "nickserv/saset/misc")
|
||||
continue;
|
||||
|
||||
Anope::string cname = block->Get<const Anope::string>("name");
|
||||
Anope::string desc = block->Get<const Anope::string>("misc_description");
|
||||
Anope::string cname = block.Get<const Anope::string>("name");
|
||||
Anope::string desc = block.Get<const Anope::string>("misc_description");
|
||||
|
||||
if (cname.empty() || desc.empty())
|
||||
continue;
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
const Anope::string &nick = params[0];
|
||||
Anope::string expiry = params[1];
|
||||
Anope::string reason = params.size() > 2 ? params[2] : "";
|
||||
time_t expiry_secs = Config->GetModule(this->owner)->Get<time_t>("suspendexpire");
|
||||
time_t expiry_secs = Config->GetModule(this->owner).Get<time_t>("suspendexpire");
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper())
|
||||
if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper())
|
||||
{
|
||||
source.Reply(_("You may not suspend other Services Operators' nicknames."));
|
||||
return;
|
||||
@@ -240,9 +240,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Anope::string s = conf->GetModule(this)->Get<Anope::string>("show");
|
||||
Anope::string s = conf.GetModule(this).Get<Anope::string>("show");
|
||||
commasepstream(s).GetTokens(show);
|
||||
std::transform(show.begin(), show.end(), show.begin(), trim());
|
||||
}
|
||||
|
||||
@@ -216,9 +216,9 @@ public:
|
||||
XLineManager::UnregisterXLineManager(&snlines);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
const Anope::string &osnick = conf->GetModule(this)->Get<const Anope::string>("client");
|
||||
const Anope::string &osnick = conf.GetModule(this).Get<const Anope::string>("client");
|
||||
|
||||
if (osnick.empty())
|
||||
throw ConfigException(this->name + ": <client> must be defined");
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
|
||||
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
|
||||
{
|
||||
if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly"))
|
||||
if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this).Get<bool>("opersonly"))
|
||||
{
|
||||
u->SendMessage(bi, ACCESS_DENIED);
|
||||
Log(bi, "bados") << "Denied access to " << bi->nick << " from " << u->GetMask() << " (non-oper)";
|
||||
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
sep.GetToken(mask);
|
||||
}
|
||||
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d");
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("autokillexpiry", "30d");
|
||||
/* If the expiry given does not contain a final letter, it's in days,
|
||||
* said the doc. Ah well.
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
|
||||
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
|
||||
{
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
|
||||
if (regexengine.empty())
|
||||
{
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
if (targ)
|
||||
mask = "*@" + targ->host;
|
||||
|
||||
if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
if (Config->GetModule("operserv").Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
reason = "[" + source.GetNick() + "] " + reason;
|
||||
|
||||
if (mask.find_first_not_of("/~@.*?") == Anope::string::npos)
|
||||
@@ -170,7 +170,7 @@ private:
|
||||
}
|
||||
|
||||
auto *x = new XLine(mask, source.GetNick(), expires, reason);
|
||||
if (Config->GetModule("operserv")->Get<bool>("akillids"))
|
||||
if (Config->GetModule("operserv").Get<bool>("akillids"))
|
||||
x->id = XLineManager::GenerateUID();
|
||||
|
||||
unsigned int affected = 0;
|
||||
@@ -202,7 +202,7 @@ private:
|
||||
}
|
||||
|
||||
akills->AddXLine(x);
|
||||
if (Config->GetModule("operserv")->Get<bool>("akillonadd"))
|
||||
if (Config->GetModule("operserv").Get<bool>("akillonadd"))
|
||||
akills->Send(NULL, x);
|
||||
|
||||
source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str());
|
||||
@@ -362,7 +362,7 @@ private:
|
||||
|
||||
ListFormatter list(source.GetAccount());
|
||||
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Expires"));
|
||||
if (Config->GetModule("operserv")->Get<bool>("akillids"))
|
||||
if (Config->GetModule("operserv").Get<bool>("akillids"))
|
||||
list.AddColumn(_("ID"));
|
||||
list.AddColumn(_("Reason"));
|
||||
|
||||
@@ -443,7 +443,7 @@ public:
|
||||
"be given, even if it is the same as the default. The\n"
|
||||
"current AKILL default expiry time can be found with the\n"
|
||||
"\002STATS AKILL\002 command."));
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
last_param = 2;
|
||||
}
|
||||
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d");
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("autokillexpiry", "30d");
|
||||
if (!expiry.empty() && isdigit(expiry[expiry.length() - 1]))
|
||||
expires *= 86400;
|
||||
if (expires && expires < 60)
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
if (!reason.empty())
|
||||
{
|
||||
Anope::string realreason;
|
||||
if (Config->GetModule("operserv")->Get<bool>("addakiller") && !source.GetNick().empty())
|
||||
if (Config->GetModule("operserv").Get<bool>("addakiller") && !source.GetNick().empty())
|
||||
realreason = "[" + source.GetNick() + "] " + reason;
|
||||
else
|
||||
realreason = reason;
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
Configuration::MutableBlock *block = Config->GetMutableBlock(params[1]);
|
||||
if (!block)
|
||||
block = Config->GetModule(params[1]);
|
||||
block = &Config->GetModule(params[1]);
|
||||
|
||||
if (!block)
|
||||
{
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
|
||||
for (unsigned i = 0; !show_blocks[i].empty(); ++i)
|
||||
{
|
||||
Configuration::Block *block = Config->GetBlock(show_blocks[i]);
|
||||
const Configuration::Block::item_map &items = block->GetItems();
|
||||
Configuration::Block &block = Config->GetBlock(show_blocks[i]);
|
||||
const Configuration::Block::item_map &items = block.GetItems();
|
||||
|
||||
ListFormatter lflist(source.GetAccount());
|
||||
lflist.AddColumn(_("Name")).AddColumn(_("Value"));
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
std::vector<Anope::string> replies;
|
||||
lflist.Process(replies);
|
||||
|
||||
source.Reply(_("%s settings:"), block->GetName().c_str());
|
||||
source.Reply(_("%s settings:"), block.GetName().c_str());
|
||||
|
||||
for (const auto &reply : replies)
|
||||
source.Reply(reply);
|
||||
@@ -87,14 +87,14 @@ public:
|
||||
|
||||
for (int i = 0; i < Config->CountBlock("module"); ++i)
|
||||
{
|
||||
Configuration::Block *block = Config->GetBlock("module", i);
|
||||
const Configuration::Block::item_map &items = block->GetItems();
|
||||
Configuration::Block &block = Config->GetBlock("module", i);
|
||||
const Configuration::Block::item_map &items = block.GetItems();
|
||||
|
||||
if (items.size() <= 1)
|
||||
continue;
|
||||
|
||||
ListFormatter::ListEntry entry;
|
||||
entry["Module Name"] = block->Get<Anope::string>("name");
|
||||
entry["Module Name"] = block.Get<Anope::string>("name");
|
||||
|
||||
for (const auto &[name, value] : items)
|
||||
{
|
||||
|
||||
@@ -331,31 +331,34 @@ public:
|
||||
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
DefconConfig dconfig;
|
||||
|
||||
dconfig.defaultlevel = block->Get<int>("defaultlevel");
|
||||
dconfig.defcons[4] = block->Get<const Anope::string>("level4");
|
||||
dconfig.defcons[3] = block->Get<const Anope::string>("level3");
|
||||
dconfig.defcons[2] = block->Get<const Anope::string>("level2");
|
||||
dconfig.defcons[1] = block->Get<const Anope::string>("level1");
|
||||
dconfig.sessionlimit = block->Get<int>("sessionlimit");
|
||||
dconfig.akillreason = block->Get<const Anope::string>("akillreason");
|
||||
dconfig.akillexpire = block->Get<time_t>("akillexpire");
|
||||
dconfig.chanmodes = block->Get<const Anope::string>("chanmodes");
|
||||
dconfig.timeout = block->Get<time_t>("timeout");
|
||||
dconfig.globalondefcon = block->Get<bool>("globalondefcon");
|
||||
dconfig.message = block->Get<const Anope::string>("message");
|
||||
dconfig.offmessage = block->Get<const Anope::string>("offmessage");
|
||||
{
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
dconfig.defaultlevel = block.Get<int>("defaultlevel");
|
||||
dconfig.defcons[4] = block.Get<const Anope::string>("level4");
|
||||
dconfig.defcons[3] = block.Get<const Anope::string>("level3");
|
||||
dconfig.defcons[2] = block.Get<const Anope::string>("level2");
|
||||
dconfig.defcons[1] = block.Get<const Anope::string>("level1");
|
||||
dconfig.sessionlimit = block.Get<int>("sessionlimit");
|
||||
dconfig.akillreason = block.Get<const Anope::string>("akillreason");
|
||||
dconfig.akillexpire = block.Get<time_t>("akillexpire");
|
||||
dconfig.chanmodes = block.Get<const Anope::string>("chanmodes");
|
||||
dconfig.timeout = block.Get<time_t>("timeout");
|
||||
dconfig.globalondefcon = block.Get<bool>("globalondefcon");
|
||||
dconfig.message = block.Get<const Anope::string>("message");
|
||||
dconfig.offmessage = block.Get<const Anope::string>("offmessage");
|
||||
}
|
||||
|
||||
block = conf->GetModule("os_session");
|
||||
|
||||
dconfig.max_session_kill = block->Get<int>("maxsessionkill");
|
||||
dconfig.session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry");
|
||||
dconfig.sle_reason = block->Get<const Anope::string>("sessionlimitexceeded");
|
||||
dconfig.sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc");
|
||||
{
|
||||
Configuration::Block &block = conf.GetModule("os_session");
|
||||
dconfig.max_session_kill = block.Get<int>("maxsessionkill");
|
||||
dconfig.session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry");
|
||||
dconfig.sle_reason = block.Get<const Anope::string>("sessionlimitexceeded");
|
||||
dconfig.sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc");
|
||||
}
|
||||
|
||||
if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5)
|
||||
throw ConfigException("The value for <defcon:defaultlevel> must be between 1 and 5");
|
||||
|
||||
@@ -752,15 +752,15 @@ public:
|
||||
delete dns_servers->at(i - 1);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = conf->GetModule(this);
|
||||
this->ttl = block->Get<time_t>("ttl");
|
||||
this->user_drop_mark = block->Get<int>("user_drop_mark");
|
||||
this->user_drop_time = block->Get<time_t>("user_drop_time");
|
||||
this->user_drop_readd_time = block->Get<time_t>("user_drop_readd_time");
|
||||
this->remove_split_servers = block->Get<bool>("remove_split_servers");
|
||||
this->readd_connected_servers = block->Get<bool>("readd_connected_servers");
|
||||
Configuration::Block &block = conf.GetModule(this);
|
||||
this->ttl = block.Get<time_t>("ttl");
|
||||
this->user_drop_mark = block.Get<int>("user_drop_mark");
|
||||
this->user_drop_time = block.Get<time_t>("user_drop_time");
|
||||
this->user_drop_readd_time = block.Get<time_t>("user_drop_readd_time");
|
||||
this->remove_split_servers = block.Get<bool>("remove_split_servers");
|
||||
this->readd_connected_servers = block.Get<bool>("readd_connected_servers");
|
||||
}
|
||||
|
||||
void OnNewServer(Server *s) override
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
}
|
||||
|
||||
NickAlias *target = NickAlias::Find(entry);
|
||||
if (target != NULL && Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper())
|
||||
if (target != NULL && Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper())
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
return;
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
BotInfo *OperServ = Config->GetClient("OperServ");
|
||||
if (IRCD->CanSQLineChannel && OperServ)
|
||||
{
|
||||
time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "1m");
|
||||
time_t inhabit = Config->GetModule("chanserv").Get<time_t>("inhabit", "1m");
|
||||
XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason);
|
||||
IRCD->SendSQLine(NULL, &x);
|
||||
}
|
||||
@@ -449,7 +449,7 @@ public:
|
||||
source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels,\n"
|
||||
"and email addresses. Wildcards are accepted for all entries."));
|
||||
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
@@ -513,7 +513,7 @@ public:
|
||||
ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
|
||||
if (IRCD->CanSQLineChannel)
|
||||
{
|
||||
time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "1m");
|
||||
time_t inhabit = Config->GetModule("chanserv").Get<time_t>("inhabit", "1m");
|
||||
XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason);
|
||||
IRCD->SendSQLine(NULL, &x);
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ public:
|
||||
" \n"
|
||||
"Ignores will not be enforced on IRC Operators."));
|
||||
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
|
||||
OperInfos *oi = e->Require<OperInfos>("operinfo");
|
||||
|
||||
if ((*oi)->size() >= Config->GetModule(this->module)->Get<unsigned>("max", "10"))
|
||||
if ((*oi)->size() >= Config->GetModule(this->module).Get<unsigned>("max", "10"))
|
||||
{
|
||||
source.Reply(_("The oper info list for \002%s\002 is full."), target.c_str());
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
{
|
||||
if (reason.empty())
|
||||
reason = "No reason specified";
|
||||
if (Config->GetModule("operserv")->Get<bool>("addakiller"))
|
||||
if (Config->GetModule("operserv").Get<bool>("addakiller"))
|
||||
reason = "(" + source.GetNick() + ") " + reason;
|
||||
Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason;
|
||||
u2->Kill(*source.service, reason);
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
"specified, lists only channels matching \002pattern\002 that have the +s or\n"
|
||||
"+p mode."));
|
||||
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
"only users that are on the given channel. If INVISIBLE is specified, only users\n"
|
||||
"with the +i flag will be listed."));
|
||||
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
bool wildcard = search_string.find_first_of("?*") != Anope::string::npos;
|
||||
bool regex = !search_string.empty() && search_string[0] == '/' && search_string[search_string.length() - 1] == '/';
|
||||
|
||||
const Anope::string &logfile_name = Config->GetModule(this->owner)->Get<const Anope::string>("logname");
|
||||
const Anope::string &logfile_name = Config->GetModule(this->owner).Get<const Anope::string>("logname");
|
||||
std::vector<Anope::string> matches;
|
||||
for (int d = days - 1; d >= 0; --d)
|
||||
{
|
||||
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
"to them. However, no more than \002%d\002 messages will be\n"
|
||||
"sent in order to avoid flooding the user. If there are\n"
|
||||
"more news messages, only the most recent will be sent."),
|
||||
Config->GetModule(this->owner)->Get<unsigned>("newscount", "3"));
|
||||
Config->GetModule(this->owner).Get<unsigned>("newscount", "3"));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
"be sent to them. However, no more than \002%d\002 messages will\n"
|
||||
"be sent in order to avoid flooding the user. If there are\n"
|
||||
"more news messages, only the most recent will be sent."),
|
||||
Config->GetModule(this->owner)->Get<unsigned>("newscount", "3"));
|
||||
Config->GetModule(this->owner).Get<unsigned>("newscount", "3"));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -399,9 +399,9 @@ class OSNews final
|
||||
|
||||
BotInfo *bi = NULL;
|
||||
if (Type == NEWS_OPER)
|
||||
bi = BotInfo::Find(Config->GetModule(this)->Get<const Anope::string>("oper_announcer", "OperServ"), true);
|
||||
bi = BotInfo::Find(Config->GetModule(this).Get<const Anope::string>("oper_announcer", "OperServ"), true);
|
||||
else
|
||||
bi = BotInfo::Find(Config->GetModule(this)->Get<const Anope::string>("announcer", "Global"), true);
|
||||
bi = BotInfo::Find(Config->GetModule(this).Get<const Anope::string>("announcer", "Global"), true);
|
||||
if (bi == NULL)
|
||||
return;
|
||||
|
||||
@@ -448,11 +448,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
oper_announcer = conf->GetModule(this)->Get<const Anope::string>("oper_announcer", "OperServ");
|
||||
announcer = conf->GetModule(this)->Get<const Anope::string>("announcer", "Global");
|
||||
news_count = conf->GetModule(this)->Get<unsigned>("newscount", "3");
|
||||
oper_announcer = conf.GetModule(this).Get<const Anope::string>("oper_announcer", "OperServ");
|
||||
announcer = conf.GetModule(this).Get<const Anope::string>("announcer", "Global");
|
||||
news_count = conf.GetModule(this).Get<unsigned>("newscount", "3");
|
||||
}
|
||||
|
||||
void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override
|
||||
|
||||
@@ -591,21 +591,21 @@ public:
|
||||
ModuleManager::SetPriority(this, PRIORITY_FIRST);
|
||||
}
|
||||
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
Configuration::Block *block = Config->GetModule(this);
|
||||
Configuration::Block &block = Config->GetModule(this);
|
||||
|
||||
session_limit = block->Get<int>("defaultsessionlimit");
|
||||
max_session_kill = block->Get<int>("maxsessionkill");
|
||||
session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry");
|
||||
sle_reason = block->Get<const Anope::string>("sessionlimitexceeded");
|
||||
sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc");
|
||||
session_limit = block.Get<int>("defaultsessionlimit");
|
||||
max_session_kill = block.Get<int>("maxsessionkill");
|
||||
session_autokill_expiry = block.Get<time_t>("sessionautokillexpiry");
|
||||
sle_reason = block.Get<const Anope::string>("sessionlimitexceeded");
|
||||
sle_detailsloc = block.Get<const Anope::string>("sessionlimitdetailsloc");
|
||||
|
||||
max_exception_limit = block->Get<int>("maxsessionlimit");
|
||||
exception_expiry = block->Get<time_t>("exceptionexpiry");
|
||||
max_exception_limit = block.Get<int>("maxsessionlimit");
|
||||
exception_expiry = block.Get<time_t>("exceptionexpiry");
|
||||
|
||||
ipv4_cidr = block->Get<unsigned>("session_ipv4_cidr", "32");
|
||||
ipv6_cidr = block->Get<unsigned>("session_ipv6_cidr", "128");
|
||||
ipv4_cidr = block.Get<unsigned>("session_ipv4_cidr", "32");
|
||||
ipv6_cidr = block.Get<unsigned>("session_ipv6_cidr", "128");
|
||||
|
||||
if (ipv4_cidr > 32 || ipv6_cidr > 128)
|
||||
throw ConfigException(this->name + ": session CIDR value out of range");
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
*
|
||||
* Rob
|
||||
**/
|
||||
bool super_admin = Config->GetModule(this->owner)->Get<bool>("superadmin");
|
||||
bool super_admin = Config->GetModule(this->owner).Get<bool>("superadmin");
|
||||
if (!super_admin)
|
||||
source.Reply(_("Super admin can not be set because it is not enabled in the configuration."));
|
||||
else if (setting.equals_ci("ON"))
|
||||
|
||||
@@ -18,14 +18,14 @@ public:
|
||||
CommandOSQuit(Module *creator) : Command(creator, "operserv/quit", 0, 1)
|
||||
{
|
||||
this->SetDesc(_("Terminate services WITHOUT saving"));
|
||||
if (Config->GetModule(this->owner)->Get<bool>("requirename"))
|
||||
if (Config->GetModule(this->owner).Get<bool>("requirename"))
|
||||
this->SetSyntax(_("\037network-name\037"));
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename");
|
||||
const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname");
|
||||
const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
|
||||
const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
|
||||
if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
|
||||
{
|
||||
OnSyntaxError(source, source.command);
|
||||
@@ -57,14 +57,14 @@ public:
|
||||
CommandOSRestart(Module *creator) : Command(creator, "operserv/restart", 0, 1)
|
||||
{
|
||||
this->SetDesc(_("Save databases and restart services"));
|
||||
if (Config->GetModule(this->owner)->Get<bool>("requirename"))
|
||||
if (Config->GetModule(this->owner).Get<bool>("requirename"))
|
||||
this->SetSyntax(_("\037network-name\037"));
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename");
|
||||
const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname");
|
||||
const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
|
||||
const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
|
||||
if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
|
||||
{
|
||||
OnSyntaxError(source, source.command);
|
||||
@@ -94,14 +94,14 @@ public:
|
||||
CommandOSShutdown(Module *creator) : Command(creator, "operserv/shutdown", 0, 1)
|
||||
{
|
||||
this->SetDesc(_("Terminate services with save"));
|
||||
if (Config->GetModule(this->owner)->Get<bool>("requirename"))
|
||||
if (Config->GetModule(this->owner).Get<bool>("requirename"))
|
||||
this->SetSyntax(_("\037network-name\037"));
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
|
||||
{
|
||||
const auto requirename = Config->GetModule(this->owner)->Get<bool>("requirename");
|
||||
const auto networkname = Config->GetBlock("networkinfo")->Get<Anope::string>("networkname");
|
||||
const auto requirename = Config->GetModule(this->owner).Get<bool>("requirename");
|
||||
const auto networkname = Config->GetBlock("networkinfo").Get<Anope::string>("networkname");
|
||||
if (requirename && (params.empty() || !params[0].equals_cs(networkname)))
|
||||
{
|
||||
OnSyntaxError(source, source.command);
|
||||
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
{
|
||||
/* AKILLs */
|
||||
source.Reply(_("Current number of AKILLs: \002%zu\002"), akills->GetCount());
|
||||
timeout = Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d") + 59;
|
||||
timeout = Config->GetModule("operserv").Get<time_t>("autokillexpiry", "30d") + 59;
|
||||
if (timeout >= 172800)
|
||||
source.Reply(_("Default AKILL expiry time: \002%d days\002"), timeout / 86400);
|
||||
else if (timeout >= 86400)
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
{
|
||||
/* SNLINEs */
|
||||
source.Reply(_("Current number of SNLINEs: \002%zu\002"), snlines->GetCount());
|
||||
timeout = Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d") + 59;
|
||||
timeout = Config->GetModule("operserv").Get<time_t>("snlineexpiry", "30d") + 59;
|
||||
if (timeout >= 172800)
|
||||
source.Reply(_("Default SNLINE expiry time: \002%d days\002"), timeout / 86400);
|
||||
else if (timeout >= 86400)
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
{
|
||||
/* SQLINEs */
|
||||
source.Reply(_("Current number of SQLINEs: \002%zu\002"), sqlines->GetCount());
|
||||
timeout = Config->GetModule("operserv")->Get<time_t>("sglineexpiry", "30d") + 59;
|
||||
timeout = Config->GetModule("operserv").Get<time_t>("sglineexpiry", "30d") + 59;
|
||||
if (timeout >= 172800)
|
||||
source.Reply(_("Default SQLINE expiry time: \002%d days\002"), timeout / 86400);
|
||||
else if (timeout >= 86400)
|
||||
|
||||
@@ -202,7 +202,7 @@ private:
|
||||
{
|
||||
ListFormatter list(source.GetAccount());
|
||||
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("By")).AddColumn(_("Created")).AddColumn(_("Expires"));
|
||||
if (Config->GetModule("operserv")->Get<bool>("akillids"))
|
||||
if (Config->GetModule("operserv").Get<bool>("akillids"))
|
||||
list.AddColumn(_("ID"));
|
||||
list.AddColumn(_("Reason"));
|
||||
|
||||
@@ -283,7 +283,7 @@ class CommandOSSNLine final
|
||||
last_param = 3;
|
||||
}
|
||||
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d");
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("snlineexpiry", "30d");
|
||||
/* If the expiry given does not contain a final letter, it's in days,
|
||||
* said the doc. Ah well.
|
||||
*/
|
||||
@@ -327,7 +327,7 @@ class CommandOSSNLine final
|
||||
|
||||
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
|
||||
{
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
|
||||
if (regexengine.empty())
|
||||
{
|
||||
@@ -361,7 +361,7 @@ class CommandOSSNLine final
|
||||
if (mask[masklen - 1] == ' ')
|
||||
mask.erase(masklen - 1);
|
||||
|
||||
if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
if (Config->GetModule("operserv").Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
reason = "[" + source.GetNick() + "] " + reason;
|
||||
|
||||
if (mask.find_first_not_of("/.*?") == Anope::string::npos)
|
||||
@@ -371,7 +371,7 @@ class CommandOSSNLine final
|
||||
}
|
||||
|
||||
auto *x = new XLine(mask, source.GetNick(), expires, reason);
|
||||
if (Config->GetModule("operserv")->Get<bool>("akillids"))
|
||||
if (Config->GetModule("operserv").Get<bool>("akillids"))
|
||||
x->id = XLineManager::GenerateUID();
|
||||
|
||||
unsigned int affected = 0;
|
||||
@@ -404,7 +404,7 @@ class CommandOSSNLine final
|
||||
|
||||
this->xlm()->AddXLine(x);
|
||||
|
||||
if (Config->GetModule("operserv")->Get<bool>("killonsnline", "yes"))
|
||||
if (Config->GetModule("operserv").Get<bool>("killonsnline", "yes"))
|
||||
{
|
||||
Anope::string rreason = "G-Lined: " + reason;
|
||||
|
||||
@@ -457,7 +457,7 @@ public:
|
||||
" \n"
|
||||
"\002Note\002: because the realname mask may contain spaces, the\n"
|
||||
"separator between it and the reason is a colon."));
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
@@ -511,7 +511,7 @@ class CommandOSSQLine final
|
||||
last_param = 3;
|
||||
}
|
||||
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv")->Get<time_t>("sqlineexpiry", "30d");
|
||||
time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : Config->GetModule("operserv").Get<time_t>("sqlineexpiry", "30d");
|
||||
/* If the expiry given does not contain a final letter, it's in days,
|
||||
* said the doc. Ah well.
|
||||
*/
|
||||
@@ -544,7 +544,7 @@ class CommandOSSQLine final
|
||||
|
||||
if (mask[0] == '/' && mask[mask.length() - 1] == '/')
|
||||
{
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
|
||||
if (regexengine.empty())
|
||||
{
|
||||
@@ -571,7 +571,7 @@ class CommandOSSQLine final
|
||||
}
|
||||
}
|
||||
|
||||
if (Config->GetModule("operserv")->Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
if (Config->GetModule("operserv").Get<bool>("addakiller", "yes") && !source.GetNick().empty())
|
||||
reason = "[" + source.GetNick() + "] " + reason;
|
||||
|
||||
if (mask.find_first_not_of("./?*") == Anope::string::npos)
|
||||
@@ -581,7 +581,7 @@ class CommandOSSQLine final
|
||||
}
|
||||
|
||||
auto *x = new XLine(mask, source.GetNick(), expires, reason);
|
||||
if (Config->GetModule("operserv")->Get<bool>("akillids"))
|
||||
if (Config->GetModule("operserv").Get<bool>("akillids"))
|
||||
x->id = XLineManager::GenerateUID();
|
||||
|
||||
unsigned int affected = 0;
|
||||
@@ -611,7 +611,7 @@ class CommandOSSQLine final
|
||||
|
||||
this->xlm()->AddXLine(x);
|
||||
|
||||
if (Config->GetModule("operserv")->Get<bool>("killonsqline", "yes"))
|
||||
if (Config->GetModule("operserv").Get<bool>("killonsqline", "yes"))
|
||||
{
|
||||
Anope::string rreason = "Q-Lined: " + reason;
|
||||
|
||||
@@ -688,7 +688,7 @@ public:
|
||||
"must be given, even if it is the same as the default. The\n"
|
||||
"current SQLINE default expiry time can be found with the\n"
|
||||
"\002STATS AKILL\002 command."));
|
||||
const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!regexengine.empty())
|
||||
{
|
||||
source.Reply(" ");
|
||||
|
||||
@@ -796,7 +796,7 @@ public:
|
||||
message_tmode(this),
|
||||
message_uid(this)
|
||||
{
|
||||
if (Config->GetModule(this))
|
||||
if (IRCD == &ircd_proto)
|
||||
this->AddModes();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class InspIRCdProto final
|
||||
private:
|
||||
static Anope::string GetAccountNicks(NickAlias* na)
|
||||
{
|
||||
if (!na || Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
|
||||
if (!na || Config->GetModule("nickserv").Get<bool>("nonicknameownership"))
|
||||
return {};
|
||||
|
||||
Anope::string nicks;
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
void SendConnect() override
|
||||
{
|
||||
Uplink::Send("CAPAB", "START", 1206);
|
||||
Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options")->Get<const Anope::string>("casemap", "ascii") + (sha256 ? " CHALLENGE=*" : ""));
|
||||
Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options").Get<const Anope::string>("casemap", "ascii") + (sha256 ? " CHALLENGE=*" : ""));
|
||||
Uplink::Send("CAPAB", "END");
|
||||
}
|
||||
|
||||
@@ -1553,7 +1553,7 @@ struct IRCDMessageCapab final
|
||||
IRCD->CanTagMessage = true;
|
||||
}
|
||||
|
||||
const auto &anoperegex = Config->GetBlock("options")->Get<const Anope::string>("regexengine");
|
||||
const auto &anoperegex = Config->GetBlock("options").Get<const Anope::string>("regexengine");
|
||||
if (!anoperegex.empty() && !inspircdregex.empty() && anoperegex != inspircdregex)
|
||||
Log() << "Warning: InspIRCd is using regex engine " << inspircdregex << ", but we have " << anoperegex << ". This may cause inconsistencies.";
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user