summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example.conf4
-rw-r--r--docs/Changes.conf1
-rw-r--r--modules/core/db_plain.cpp7
-rw-r--r--modules/core/os_defcon.cpp6
-rw-r--r--src/config.cpp17
-rw-r--r--src/memoserv.cpp23
-rw-r--r--src/messages.cpp8
7 files changed, 35 insertions, 31 deletions
diff --git a/data/example.conf b/data/example.conf
index c9b8a0573..22614de06 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -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
{
diff --git a/docs/Changes.conf b/docs/Changes.conf
index 992624d63..7be05ef02 100644
--- a/docs/Changes.conf
+++ b/docs/Changes.conf
@@ -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
diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp
index dc108ac06..432313bc2 100644
--- a/modules/core/db_plain.cpp
+++ b/modules/core/db_plain.cpp
@@ -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;
}
}
diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp
index 525aa9b94..89bc2b6f0 100644
--- a/modules/core/os_defcon.cpp
+++ b/modules/core/os_defcon.cpp
@@ -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"))
{
diff --git a/src/config.cpp b/src/config.cpp
index fda4d3881..a3374c0be 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -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},
diff --git a/src/memoserv.cpp b/src/memoserv.cpp
index b1e32a673..f27db9742 100644
--- a/src/memoserv.cpp
+++ b/src/memoserv.cpp
@@ -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;
diff --git a/src/messages.cpp b/src/messages.cpp
index e9a37e02b..1cb0efd3b 100644
--- a/src/messages.cpp
+++ b/src/messages.cpp
@@ -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)
{