summaryrefslogtreecommitdiff
path: root/modules/commands/ms_check.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-05-28 12:07:29 -0400
committerAdam <Adam@anope.org>2014-05-28 12:07:54 -0400
commitf29e1cf383529a1a29f02b0669d973f5ee0b7a66 (patch)
tree3c33db276dc9328235bbd572641521ed44458176 /modules/commands/ms_check.cpp
parent1253c70e0682fa1490c99c3d2869049a0e3fa2e0 (diff)
Move most of the core pseudoclient logic to modules
Diffstat (limited to 'modules/commands/ms_check.cpp')
-rw-r--r--modules/commands/ms_check.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp
index a534aaca3..f20724a45 100644
--- a/modules/commands/ms_check.cpp
+++ b/modules/commands/ms_check.cpp
@@ -27,34 +27,35 @@ class CommandMSCheck : public Command
bool found = false;
- const NickAlias *na = NickAlias::Find(recipient);
+ const NickServ::Nick *na = NickServ::FindNick(recipient);
if (!na)
{
source.Reply(NICK_X_NOT_REGISTERED, recipient.c_str());
return;
}
- MemoInfo *mi = &na->nc->memos;
+ MemoServ::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 (unsigned i = mi->memos->size(); i > 0; --i)
- {
- Memo *m = mi->GetMemo(i - 1);
- NickAlias *na2 = NickAlias::Find(m->sender);
-
- if (na2 != NULL && na2->nc == source.GetAccount())
+ if (mi)
+ for (unsigned i = mi->memos->size(); i > 0; --i)
{
- found = true; /* Yes, we've found the memo */
-
- if (m->unread)
- source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
- else
- source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
- break;
+ MemoServ::Memo *m = mi->GetMemo(i - 1);
+ NickServ::Nick *na2 = NickServ::FindNick(m->sender);
+
+ if (na2 != NULL && na2->nc == source.GetAccount())
+ {
+ found = true; /* Yes, we've found the memo */
+
+ if (m->unread)
+ source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
+ else
+ source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str());
+ break;
+ }
}
- }
if (!found)
source.Reply(_("Nick %s doesn't have a memo from you."), na->nick.c_str());