diff options
author | Adam <Adam@anope.org> | 2013-11-18 17:15:21 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-11-18 17:18:00 -0500 |
commit | 826ae9b6c0bfc5822ca04a39c776b70416bafbc7 (patch) | |
tree | 1e5be0733bd2f9f922c72bf3ff690920443123d0 /modules/commands/ms_check.cpp | |
parent | 2c3e8a76c92b8452c326bc22d8d4a443aa8cb2aa (diff) |
Make /ms check better able to tell if youve recently sent a memo to someone
Diffstat (limited to 'modules/commands/ms_check.cpp')
-rw-r--r-- | modules/commands/ms_check.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp index a6d72c376..b20739e6d 100644 --- a/modules/commands/ms_check.cpp +++ b/modules/commands/ms_check.cpp @@ -39,16 +39,19 @@ class CommandMSCheck : public Command /* Okay, I know this looks strange but we wanna get the LAST memo, so we have to loop backwards */ - for (int i = mi->memos->size() - 1; i >= 0; --i) + for (unsigned i = mi->memos->size(); i > 0; --i) { - if (source.nc->display.equals_ci(mi->GetMemo(i)->sender)) + Memo *m = mi->GetMemo(i - 1); + NickAlias *na2 = NickAlias::Find(m->sender); + + if (na2 != NULL && na2->nc == source.GetAccount()) { found = true; /* Yes, we've found the memo */ - if (mi->GetMemo(i)->unread) - source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(mi->GetMemo(i)->time, source.GetAccount()).c_str()); + 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(mi->GetMemo(i)->time, source.GetAccount()).c_str()); + 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; } } |