summaryrefslogtreecommitdiff
path: root/modules/core/ms_check.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-11-24 21:40:56 -0600
committerAdam <Adam@anope.org>2010-12-12 19:36:19 -0500
commitcb6ef574e3df5cc846247450b74ca37d265f319e (patch)
tree8ce3374a537c312af63c78125bfea4622bb188f0 /modules/core/ms_check.cpp
parent37e02a3594fdddc3d5a3df0501c528f42db6c4da (diff)
Send replies from fantasy commands back to the channel, this will be expanded on later
Diffstat (limited to 'modules/core/ms_check.cpp')
-rw-r--r--modules/core/ms_check.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/modules/core/ms_check.cpp b/modules/core/ms_check.cpp
index f6d9e9833..80b30d2ac 100644
--- a/modules/core/ms_check.cpp
+++ b/modules/core/ms_check.cpp
@@ -20,46 +20,48 @@ class CommandMSCheck : public Command
{
}
- CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
+ CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
- NickAlias *na = NULL;
- MemoInfo *mi = NULL;
- int i, found = 0;
- Anope::string recipient = params[0];
+ User *u = source.u;
- if (!(na = findnick(recipient)))
+ const Anope::string &recipient = params[0];
+
+ bool found = false;
+
+ NickAlias *na = findnick(recipient);
+ if (!na)
{
- u->SendMessage(MemoServ, NICK_X_NOT_REGISTERED, recipient.c_str());
+ source.Reply(NICK_X_NOT_REGISTERED, recipient.c_str());
return MOD_CONT;
}
if (na->HasFlag(NS_FORBIDDEN))
{
- u->SendMessage(MemoServ, NICK_X_FORBIDDEN, recipient.c_str());
+ source.Reply(NICK_X_FORBIDDEN, recipient.c_str());
return MOD_CONT;
}
- mi = &na->nc->memos;
+ MemoInfo *mi = &na->nc->memos;
/* Okay, I know this looks strange but we wanna get the LAST memo, so we
have to loop backwards */
- for (i = mi->memos.size() - 1; i >= 0; --i)
+ for (int i = mi->memos.size() - 1; i >= 0; --i)
{
if (u->Account()->display.equals_ci(mi->memos[i]->sender))
{
- found = 1; /* Yes, we've found the memo */
+ found = true; /* Yes, we've found the memo */
if (mi->memos[i]->HasFlag(MF_UNREAD))
- u->SendMessage(MemoServ, MEMO_CHECK_NOT_READ, na->nick.c_str(), do_strftime(mi->memos[i]->time).c_str());
+ source.Reply(MEMO_CHECK_NOT_READ, na->nick.c_str(), do_strftime(mi->memos[i]->time).c_str());
else
- u->SendMessage(MemoServ, MEMO_CHECK_READ, na->nick.c_str(), do_strftime(mi->memos[i]->time).c_str());
+ source.Reply(MEMO_CHECK_READ, na->nick.c_str(), do_strftime(mi->memos[i]->time).c_str());
break;
}
}
if (!found)
- u->SendMessage(MemoServ, MEMO_CHECK_NO_MEMO, na->nick.c_str());
+ source.Reply(MEMO_CHECK_NO_MEMO, na->nick.c_str());
return MOD_CONT;
}