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

Merge the two memo del events into one. Since they had the same name it was confusing the event system

This commit is contained in:
Adam
2013-09-20 15:21:32 -04:00
parent b880240d72
commit 8641b995c4
3 changed files with 6 additions and 25 deletions
+2 -9
View File
@@ -876,18 +876,11 @@ class CoreExport Module : public Extensible
virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) { throw NotImplementedException(); }
/** Called when a memo is deleted
* @param nc The nickcore of the memo being deleted
* @param target The target the memo is being deleted from (nick or channel)
* @param mi The memo info
* @param m The memo
*/
virtual void OnMemoDel(NickCore *nc, MemoInfo *mi, const Memo *m) { throw NotImplementedException(); }
/** Called when a memo is deleted
* @param ci The channel of the memo being deleted
* @param mi The memo info
* @param m The memo
*/
virtual void OnMemoDel(ChannelInfo *ci, MemoInfo *mi, const Memo *m) { throw NotImplementedException(); }
virtual void OnMemoDel(const Anope::string &target, MemoInfo *mi, const Memo *m) { throw NotImplementedException(); }
/** Called when a mode is set on a channel
* @param c The channel
+1 -4
View File
@@ -40,10 +40,7 @@ class CommandMSCancel : public Command
for (int i = mi->memos->size() - 1; i >= 0; --i)
if (mi->GetMemo(i)->unread && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
{
if (ischan)
FOREACH_MOD(OnMemoDel, (ci, mi, mi->GetMemo(i)));
else
FOREACH_MOD(OnMemoDel, (na->nc, mi, mi->GetMemo(i)));
FOREACH_MOD(OnMemoDel, (ischan ? ci->name : na->nc->display, mi, mi->GetMemo(i)));
mi->Del(i);
source.Reply(_("Last memo to \002%s\002 has been cancelled."), nname.c_str());
return;
+3 -12
View File
@@ -26,10 +26,7 @@ class MemoDelCallback : public NumberList
if (!number || number > mi->memos->size())
return;
if (ci)
FOREACH_MOD(OnMemoDel, (ci, mi, mi->GetMemo(number - 1)));
else
FOREACH_MOD(OnMemoDel, (source.nc, mi, mi->GetMemo(number - 1)));
FOREACH_MOD(OnMemoDel, (ci ? ci->name : source.nc->display, mi, mi->GetMemo(number - 1)));
mi->Del(number - 1);
source.Reply(_("Memo %d has been deleted."), number);
@@ -96,10 +93,7 @@ class CommandMSDel : public Command
else if (numstr.equals_ci("LAST"))
{
/* Delete last memo. */
if (ci)
FOREACH_MOD(OnMemoDel, (ci, mi, mi->GetMemo(mi->memos->size() - 1)));
else
FOREACH_MOD(OnMemoDel, (source.nc, mi, mi->GetMemo(mi->memos->size() - 1)));
FOREACH_MOD(OnMemoDel, (ci ? ci->name : source.nc->display, mi, mi->GetMemo(mi->memos->size() - 1)));
mi->Del(mi->memos->size() - 1);
source.Reply(_("Memo %d has been deleted."), mi->memos->size() + 1);
}
@@ -108,10 +102,7 @@ class CommandMSDel : public Command
/* Delete all memos. */
for (unsigned i = 0, end = mi->memos->size(); i < end; ++i)
{
if (ci)
FOREACH_MOD(OnMemoDel, (ci, mi, mi->GetMemo(i)));
else
FOREACH_MOD(OnMemoDel, (source.nc, mi, mi->GetMemo(i)));
FOREACH_MOD(OnMemoDel, (ci ? ci->name : source.nc->display, mi, mi->GetMemo(i)));
delete mi->GetMemo(i);
}
mi->memos->clear();