diff options
Diffstat (limited to 'modules/memoserv')
| -rw-r--r-- | modules/memoserv/main/memoserv.cpp | 33 | ||||
| -rw-r--r-- | modules/memoserv/read.cpp | 12 |
2 files changed, 32 insertions, 13 deletions
diff --git a/modules/memoserv/main/memoserv.cpp b/modules/memoserv/main/memoserv.cpp index 757b95563..833a32f68 100644 --- a/modules/memoserv/main/memoserv.cpp +++ b/modules/memoserv/main/memoserv.cpp @@ -95,18 +95,29 @@ class MemoServCore : public Module, public MemoServ::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/main")->Get<time_t>("senddelay"); - if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime) - return MEMO_TOO_FAST; - if (!mi->GetMemoMax()) - return MEMO_TARGET_FULL; - if (mi->GetMemoMax() > 0 && mi->GetMemos().size() >= static_cast<unsigned>(mi->GetMemoMax())) - return MEMO_TARGET_FULL; - if (mi->HasIgnore(sender)) - return MEMO_SUCCESS; + if (!sender->HasPriv("memoserv/no-limit") && !force) + { + time_t send_delay = Config->GetModule("memoserv/main")->Get<time_t>("senddelay"); + if (send_delay > 0 && sender->lastmemosend + send_delay > Anope::CurTime) + return MEMO_TOO_FAST; + if (!mi->GetMemoMax()) + return MEMO_TARGET_FULL; + if (mi->GetMemoMax() > 0 && mi->GetMemos().size() >= static_cast<unsigned>(mi->GetMemoMax())) + return MEMO_TARGET_FULL; + if (mi->HasIgnore(sender)) + return MEMO_SUCCESS; + } + + NickServ::Account *acc = sender->Account(); + if (acc != NULL) + { + sender_display = acc->GetDisplay(); + } } if (sender != NULL) @@ -114,7 +125,7 @@ class MemoServCore : public Module, public MemoServ::MemoServService MemoServ::Memo *m = Serialize::New<MemoServ::Memo *>(); m->SetMemoInfo(mi); - m->SetSender(source); + m->SetSender(sender_display); m->SetTime(Anope::CurTime); m->SetText(message); m->SetUnread(true); diff --git a/modules/memoserv/read.cpp b/modules/memoserv/read.cpp index 706682a32..4eff0a2b3 100644 --- a/modules/memoserv/read.cpp +++ b/modules/memoserv/read.cpp @@ -88,7 +88,7 @@ class CommandMSRead : public Command CommandMSRead(Module *creator) : Command(creator, "memoserv/read", 1, 2) { this->SetDesc(_("Read a memo or memos")); - this->SetSyntax(_("[\037channel\037] {\037num\037 | \037list\037 | LAST | NEW}")); + this->SetSyntax(_("[\037channel\037] {\037num\037 | \037list\037 | LAST | NEW | ALL}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -122,7 +122,7 @@ class CommandMSRead : public Command mi = source.nc->GetMemos(); } - if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && numstr.find_first_not_of("0123456789.,-") != Anope::string::npos)) + if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && !numstr.equals_ci("ALL") && numstr.find_first_not_of("0123456789.,-") != Anope::string::npos)) { this->OnSyntaxError(source, numstr); return; @@ -166,6 +166,13 @@ class CommandMSRead : public Command for (i = 0, end = memos.size() - 1; i < end; ++i); DoRead(source, mi, ci, i); } + else if (numstr.equals_ci("ALL")) + { + for (i = 0, end = memos.size(); i < end; ++i) + { + DoRead(source, mi, ci, i); + } + } else /* number[s] */ { bool shown = false; @@ -191,6 +198,7 @@ class CommandMSRead : public Command source.Reply(_("Sends you the text of the memos specified." " If LAST is given, sends you the memo you most recently received." " If NEW is given, sends you all of your new memos." + " If ALL is given, sends you all of your memos." " Otherwise, sends you memo number \037num\037." " You can also give a list of numbers, as in the example:\n" "\n" |
