1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 17:03:12 +02:00

Make /ms check better able to tell if youve recently sent a memo to someone

This commit is contained in:
Adam
2013-11-18 17:15:21 -05:00
parent 2c3e8a76c9
commit 826ae9b6c0
+8 -5
View File
@@ -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;
}
}