mirror of
https://github.com/anope/anope.git
synced 2026-07-10 01:03:13 +02:00
Made MemoServ optional
This commit is contained in:
+15
-2
@@ -543,6 +543,19 @@ bool ValidateBantype(ServerConfig *, const Anope::string &, const Anope::string
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMemoServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data)
|
||||
{
|
||||
if (!config->s_MemoServ.empty())
|
||||
{
|
||||
if (value.equals_ci("description"))
|
||||
{
|
||||
if (data.GetValue().empty())
|
||||
throw ConfigException("The value for <" + tag + ":" + value + "> cannot be empty when MemoServ is enabled!");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateBotServ(ServerConfig *config, const Anope::string &tag, const Anope::string &value, ValueItem &data)
|
||||
{
|
||||
if (!config->s_BotServ.empty())
|
||||
@@ -1088,8 +1101,8 @@ void ServerConfig::Read()
|
||||
{"chanserv", "listopersonly", "no", new ValueContainerBool(&this->CSListOpersOnly), DT_BOOLEAN, NoValidation},
|
||||
{"chanserv", "listmax", "0", new ValueContainerUInt(&this->CSListMax), DT_UINTEGER, ValidateNotZero},
|
||||
{"chanserv", "opersonly", "no", new ValueContainerBool(&this->CSOpersOnly), DT_BOOLEAN, NoValidation},
|
||||
{"memoserv", "nick", "MemoServ", new ValueContainerString(&this->s_MemoServ), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"memoserv", "description", "Memo Service", new ValueContainerString(&this->desc_MemoServ), DT_STRING | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"memoserv", "nick", "", new ValueContainerString(&this->s_MemoServ), DT_STRING | DT_NORELOAD, NoValidation},
|
||||
{"memoserv", "description", "Memo Service", new ValueContainerString(&this->desc_MemoServ), DT_STRING | DT_NORELOAD, ValidateMemoServ},
|
||||
{"memoserv", "modules", "", new ValueContainerString(&MemoCoreModules), DT_STRING, NoValidation},
|
||||
{"memoserv", "maxmemos", "0", new ValueContainerUInt(&this->MSMaxMemos), DT_UINTEGER, NoValidation},
|
||||
{"memoserv", "senddelay", "0", new ValueContainerTime(&this->MSSendDelay), DT_TIME, NoValidation},
|
||||
|
||||
+8
-15
@@ -12,29 +12,16 @@
|
||||
#include "services.h"
|
||||
#include "modules.h"
|
||||
|
||||
/*************************************************************************/
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
static bool SendMemoMail(NickCore *nc, Memo *m);
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
void moduleAddMemoServCmds()
|
||||
{
|
||||
ModuleManager::LoadModuleList(Config->MemoServCoreModules);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/**
|
||||
* MemoServ initialization.
|
||||
* @return void
|
||||
*/
|
||||
void ms_init()
|
||||
{
|
||||
moduleAddMemoServCmds();
|
||||
if (!Config->s_MemoServ.empty())
|
||||
ModuleManager::LoadModuleList(Config->MemoServCoreModules);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -47,6 +34,9 @@ void ms_init()
|
||||
*/
|
||||
void check_memos(User *u)
|
||||
{
|
||||
if (Config->s_MemoServ.empty())
|
||||
return;
|
||||
|
||||
if (!u)
|
||||
{
|
||||
Log() << "check_memos called with NULL values";
|
||||
@@ -167,6 +157,9 @@ MemoInfo *getmemoinfo(const Anope::string &name, bool &ischan, bool &isforbid)
|
||||
*/
|
||||
void memo_send(User *u, const Anope::string &name, const Anope::string &text, int z)
|
||||
{
|
||||
if (Config->s_MemoServ.empty())
|
||||
return;
|
||||
|
||||
bool ischan, isforbid;
|
||||
MemoInfo *mi;
|
||||
Anope::string source = u->Account()->display;
|
||||
|
||||
+4
-4
@@ -174,23 +174,23 @@ int m_privmsg(const Anope::string &source, const Anope::string &receiver, const
|
||||
ircdproto->SendCTCP(bi, u->nick, "VERSION Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::Build().c_str());
|
||||
}
|
||||
}
|
||||
else if (bi->nick.equals_ci(Config->s_NickServ) || bi->nick.equals_ci(Config->s_MemoServ) || (!Config->s_BotServ.empty() && bi->nick.equals_ci(Config->s_BotServ)))
|
||||
if (bi == NickServ || bi == MemoServ || bi == BotServ)
|
||||
mod_run_cmd(bi, u, message);
|
||||
else if (bi->nick.equals_ci(Config->s_ChanServ))
|
||||
else if (bi == ChanServ)
|
||||
{
|
||||
if (!is_oper(u) && Config->CSOpersOnly)
|
||||
u->SendMessage(ChanServ, ACCESS_DENIED);
|
||||
else
|
||||
mod_run_cmd(bi, u, message);
|
||||
}
|
||||
else if (!Config->s_HostServ.empty() && bi->nick.equals_ci(Config->s_HostServ))
|
||||
else if (bi == HostServ)
|
||||
{
|
||||
if (!ircd->vhost)
|
||||
u->SendMessage(HostServ, SERVICE_OFFLINE, Config->s_HostServ.c_str());
|
||||
else
|
||||
mod_run_cmd(bi, u, message);
|
||||
}
|
||||
else if (bi->nick.equals_ci(Config->s_OperServ))
|
||||
else if (bi == OperServ)
|
||||
{
|
||||
if (!is_oper(u) && Config->OSOpersOnly)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user