diff options
Diffstat (limited to 'modules/core/ms_check.cpp')
-rw-r--r-- | modules/core/ms_check.cpp | 30 |
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> ¶ms) + CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) { - 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; } |