1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 14:56:37 +02:00

Made MemoServ optional

This commit is contained in:
Adam
2010-10-02 00:07:39 -04:00
parent e3afb119b9
commit a62d824cb4
7 changed files with 35 additions and 31 deletions
+2 -2
View File
@@ -1137,10 +1137,10 @@ chanserv
}
/*
* [REQUIRED] MemoServ Config
* [OPTIONAL] MemoServ Config
*
* This section is used to set up the Memo Service pseudo-client. Unless specified otherwise,
* all directives are required.
* all directives are required if you wish to use MemoServ.
*/
memoserv
{
+1
View File
@@ -21,6 +21,7 @@ operserv:modules changed os_sgline to os_snline
operserv:sglineexpiry changed to operserv:snlineexpiry
operserv:killonsgline changed to operserv:killonsnline
operserv:notifications ossgline changed ossnline
memoserv was made optional
** DELETED CONFIGURATION DIRECTIVES **
serverinfo:helpchannel removed because it has been readded in m_helpchan
+2 -5
View File
@@ -928,12 +928,9 @@ class DBPlain : public Module
BotInfo *bi = it->second;
db << "BI " << bi->nick << " " << bi->GetIdent() << " " << bi->host << " " << bi->created << " " << bi->chancount << " :" << bi->realname << endl;
if (bi->FlagCount())
if (bi->HasFlag(BI_PRIVATE))
{
db << "MD FLAGS";
if (bi->HasFlag(BI_PRIVATE))
db << " PRIVATE";
db << endl;
db << "MD FLAGS PRIVATE" << endl;
}
}
+3 -3
View File
@@ -225,7 +225,7 @@ class OSDefcon : public Module
EventReturn OnPreCommand(User *u, BotInfo *service, const Anope::string &command, const std::vector<Anope::string> &params)
{
if (service == findbot(Config->s_NickServ))
if (service == NickServ)
{
if (command.equals_ci("REGISTER") || command.equals_ci("GROUP"))
{
@@ -236,7 +236,7 @@ class OSDefcon : public Module
}
}
}
else if (service == findbot(Config->s_ChanServ))
else if (ChanServ && service == ChanServ)
{
if (command.equals_ci("SET"))
{
@@ -255,7 +255,7 @@ class OSDefcon : public Module
}
}
}
else if (service == findbot(Config->s_MemoServ))
else if (MemoServ && service == MemoServ)
{
if (command.equals_ci("SEND") || command.equals_ci("SENDALL"))
{
+15 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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)
{