summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules.h11
-rw-r--r--modules/commands/ms_cancel.cpp5
-rw-r--r--modules/commands/ms_del.cpp15
3 files changed, 6 insertions, 25 deletions
diff --git a/include/modules.h b/include/modules.h
index 084a8dc26..f784c9cb8 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -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
diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp
index 18ddcfa09..5b6b0b23f 100644
--- a/modules/commands/ms_cancel.cpp
+++ b/modules/commands/ms_cancel.cpp
@@ -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;
diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp
index c789e697b..963239f7f 100644
--- a/modules/commands/ms_del.cpp
+++ b/modules/commands/ms_del.cpp
@@ -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();