From 1c82697ccbf85359e86ec815bd66a74803c7ac3f Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 30 Sep 2016 20:52:38 -0400 Subject: Revert "Always use display for memo source" This reverts commit d8a945b1a6f4e500bcb9162cf388f6984ad38328. --- modules/commands/ms_rsend.cpp | 2 +- modules/commands/ms_send.cpp | 2 +- modules/commands/ms_sendall.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp index e703ba067..b7744131a 100644 --- a/modules/commands/ms_rsend.cpp +++ b/modules/commands/ms_rsend.cpp @@ -51,7 +51,7 @@ class CommandMSRSend : public Command source.Reply(ACCESS_DENIED); else { - MemoServService::MemoResult result = memoserv->Send(source.GetAccount()->display, nick, text); + MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text); if (result == MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServService::MEMO_TOO_FAST) diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp index 73ffd4c41..b028706d3 100644 --- a/modules/commands/ms_send.cpp +++ b/modules/commands/ms_send.cpp @@ -45,7 +45,7 @@ class CommandMSSend : public Command return; } - MemoServService::MemoResult result = memoserv->Send(source.GetAccount()->display, nick, text); + MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text); if (result == MemoServService::MEMO_SUCCESS) { source.Reply(_("Memo sent to \002%s\002."), nick.c_str()); diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp index 8f0514d6f..4cc0f350c 100644 --- a/modules/commands/ms_sendall.cpp +++ b/modules/commands/ms_sendall.cpp @@ -39,7 +39,7 @@ class CommandMSSendAll : public Command const NickCore *nc = it->second; if (nc != source.nc) - memoserv->Send(source.GetAccount()->display, nc->display, text); + memoserv->Send(source.GetNick(), nc->display, text); } source.Reply(_("A massmemo has been sent to all registered users.")); -- cgit From fc0171fb40cf1785492eda566fd33b3ff5ef66b4 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 30 Sep 2016 21:03:35 -0400 Subject: memoserv: always use display for memo source --- modules/pseudoclients/memoserv.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp index 37e9545aa..2eda9f30c 100644 --- a/modules/pseudoclients/memoserv.cpp +++ b/modules/pseudoclients/memoserv.cpp @@ -49,18 +49,29 @@ class MemoServCore : public Module, public MemoServService if (mi == NULL) return MEMO_INVALID_TARGET; + Anope::string sender_display = source; + User *sender = User::Find(source, true); - if (sender != NULL && !sender->HasPriv("memoserv/no-limit") && !force) + if (sender != NULL) { - time_t send_delay = Config->GetModule("memoserv")->Get("senddelay"); - if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime) - return MEMO_TOO_FAST; - else if (!mi->memomax) - return MEMO_TARGET_FULL; - else if (mi->memomax > 0 && mi->memos->size() >= static_cast(mi->memomax)) - return MEMO_TARGET_FULL; - else if (mi->HasIgnore(sender)) - return MEMO_SUCCESS; + if (!sender->HasPriv("memoserv/no-limit") && !force) + { + time_t send_delay = Config->GetModule("memoserv")->Get("senddelay"); + if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime) + return MEMO_TOO_FAST; + else if (!mi->memomax) + return MEMO_TARGET_FULL; + else if (mi->memomax > 0 && mi->memos->size() >= static_cast(mi->memomax)) + return MEMO_TARGET_FULL; + else if (mi->HasIgnore(sender)) + return MEMO_SUCCESS; + } + + NickCore *acc = sender->Account(); + if (acc != NULL) + { + sender_display = acc->display; + } } if (sender != NULL) @@ -70,7 +81,7 @@ class MemoServCore : public Module, public MemoServService m->mi = mi; mi->memos->push_back(m); m->owner = target; - m->sender = source; + m->sender = sender_display; m->time = Anope::CurTime; m->text = message; m->unread = true; -- cgit