summaryrefslogtreecommitdiff
path: root/modules/commands/ms_rsend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/ms_rsend.cpp')
-rw-r--r--modules/commands/ms_rsend.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index e5c345c75..a9372c328 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -12,9 +12,11 @@
/*************************************************************************/
#include "module.h"
-#include "memoserv.h"
-static ServiceReference<MemoServService> MemoServService("MemoServService", "MemoServ");
+namespace
+{
+ ServiceReference<MemoServService> memoserv("MemoServService", "MemoServ");
+}
class CommandMSRSend : public Command
{
@@ -27,10 +29,9 @@ class CommandMSRSend : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
- if (!MemoServService)
+ if (!memoserv)
return;
-
const Anope::string &nick = params[0];
const Anope::string &text = params[1];
const NickAlias *na = NULL;
@@ -42,25 +43,20 @@ class CommandMSRSend : public Command
return;
}
- if (Config->MSMemoReceipt == 1 && !source.IsServicesOper())
+ if (Config->GetModule(this->owner)->Get<bool>("operonly") && !source.IsServicesOper())
source.Reply(ACCESS_DENIED);
- else if (Config->MSMemoReceipt > 2 || Config->MSMemoReceipt == 0)
- {
- Log(this->owner) << "MSMemoReceipt is misconfigured to " << Config->MSMemoReceipt;
- source.Reply(_("Sorry, RSEND has been disabled on this network."));
- }
else
{
- MemoServService::MemoResult result = MemoServService->Send(source.GetNick(), nick, text);
+ MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
if (result == MemoServService::MEMO_INVALID_TARGET)
source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str());
else if (result == MemoServService::MEMO_TOO_FAST)
- source.Reply(_("Please wait %d seconds before using the SEND command again."), Config->MSSendDelay);
+ source.Reply(_("Please wait %d seconds before using the %s command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command.c_str());
else if (result == MemoServService::MEMO_TARGET_FULL)
source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str());
else
{
- source.Reply(_("Memo sent to \002%s\002."), name.c_str());
+ source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
bool ischan;
MemoInfo *mi = MemoInfo::GetMemoInfo(nick, ischan);
@@ -71,8 +67,6 @@ class CommandMSRSend : public Command
m->receipt = true;
}
}
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
@@ -95,15 +89,11 @@ class MSRSend : public Module
CommandMSRSend commandmsrsend;
public:
- MSRSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
+ MSRSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandmsrsend(this)
{
- this->SetAuthor("Anope");
-
- if (!MemoServService)
+ if (!memoserv)
throw ModuleException("No MemoServ!");
- else if (!Config->MSMemoReceipt)
- throw ModuleException("Invalid value for memoreceipt");
}
};