summaryrefslogtreecommitdiff
path: root/modules/core/ms_send.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-22 03:16:11 -0400
committerAdam <Adam@anope.org>2011-05-16 04:06:17 -0400
commitc8c23158a4ff74822d6c7d201dc53d879e3d91e8 (patch)
tree4bc9ae029691d5e7c03ebc1481683a010b733844 /modules/core/ms_send.cpp
parent1782ce260c5bc214ec0b2e39257ab1371b68ae9c (diff)
Moved the core pseudo clients out into their own modules
Diffstat (limited to 'modules/core/ms_send.cpp')
-rw-r--r--modules/core/ms_send.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/core/ms_send.cpp b/modules/core/ms_send.cpp
index babeb291c..c7bc0bb4c 100644
--- a/modules/core/ms_send.cpp
+++ b/modules/core/ms_send.cpp
@@ -12,6 +12,7 @@
/*************************************************************************/
#include "module.h"
+#include "memoserv.h"
class CommandMSSend : public Command
{
@@ -25,7 +26,17 @@ class CommandMSSend : public Command
{
const Anope::string &nick = params[0];
const Anope::string &text = params[1];
- memo_send(source, nick, text, 0);
+
+ MemoServService::MemoResult result = memoserv->Send(source.u->nick, nick, text);
+ if (result == MemoServService::MEMO_SUCCESS)
+ source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
+ else 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);
+ else if (result == MemoServService::MEMO_TARGET_FULL)
+ source.Reply(_("%s currently has too many memos and cannot receive more."), nick.c_str());
+
return MOD_CONT;
}
@@ -56,7 +67,10 @@ class MSSend : public Module
this->SetAuthor("Anope");
this->SetType(CORE);
- this->AddCommand(MemoServ, &commandmssend);
+ if (!memoserv)
+ throw ModuleException("MemoServ is not loaded!");
+
+ this->AddCommand(memoserv->Bot(), &commandmssend);
}
};