diff options
| author | Adam <Adam@anope.org> | 2016-10-22 16:43:18 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-10-22 16:52:29 -0400 |
| commit | fce6169f4e134a99dbb19997337b1bb250889147 (patch) | |
| tree | b6f2f6c1bc7094a32b5dc6bb1df97fc4b675e9e0 /modules/memoserv | |
| parent | 06f40cabcb167e2764c03092f6ec3f7383983f95 (diff) | |
Various codestyle cleanup in most of the core modules
Diffstat (limited to 'modules/memoserv')
| -rw-r--r-- | modules/memoserv/del.cpp | 2 | ||||
| -rw-r--r-- | modules/memoserv/ignore.cpp | 2 | ||||
| -rw-r--r-- | modules/memoserv/info.cpp | 8 | ||||
| -rw-r--r-- | modules/memoserv/list.cpp | 2 | ||||
| -rw-r--r-- | modules/memoserv/main/memoserv.cpp | 10 | ||||
| -rw-r--r-- | modules/memoserv/read.cpp | 3 | ||||
| -rw-r--r-- | modules/memoserv/send.cpp | 6 | ||||
| -rw-r--r-- | modules/memoserv/set.cpp | 12 |
8 files changed, 41 insertions, 4 deletions
diff --git a/modules/memoserv/del.cpp b/modules/memoserv/del.cpp index 17ef2a39f..fbefe180e 100644 --- a/modules/memoserv/del.cpp +++ b/modules/memoserv/del.cpp @@ -62,7 +62,9 @@ class CommandMSDel : public Command mi = ci->GetMemos(); } else + { mi = source.nc->GetMemos(); + } if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST"))) { diff --git a/modules/memoserv/ignore.cpp b/modules/memoserv/ignore.cpp index 42e94a609..520aeaf7f 100644 --- a/modules/memoserv/ignore.cpp +++ b/modules/memoserv/ignore.cpp @@ -130,7 +130,9 @@ class CommandMSIgnore : public Command source.Reply(replies[i]); } else + { this->OnSyntaxError(source, ""); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/memoserv/info.cpp b/modules/memoserv/info.cpp index aff622b21..05ca0c213 100644 --- a/modules/memoserv/info.cpp +++ b/modules/memoserv/info.cpp @@ -45,6 +45,7 @@ class CommandMSInfo : public Command source.Reply(_("\002{0}\002 isn't registered."), nname); return; } + mi = na->GetAccount()->GetMemos(); hardmax = na->GetAccount()->HasFieldS("MEMO_HARDMAX"); } @@ -76,6 +77,7 @@ class CommandMSInfo : public Command mi = nc->GetMemos(); hardmax = nc->HasFieldS("MEMO_HARDMAX"); } + if (!mi) return; @@ -115,7 +117,9 @@ class CommandMSInfo : public Command source.Reply(_("The memo limit of \002{0}\002 is \002{1}\002."), nname, mi->GetMemoMax()); } else + { source.Reply(_("\002{0}\002 has no memo limit."), nname); + } if (na) { @@ -132,7 +136,9 @@ class CommandMSInfo : public Command else { if (memos.empty()) + { source.Reply(_("You currently have no memos.")); + } else if (memos.size() == 1) { if (mi->GetMemo(0)->GetUnread()) @@ -196,7 +202,9 @@ class CommandMSInfo : public Command source.Reply(_("You will be notified of new memos at logon.")); } else + { source.Reply(_("You will not be notified of new memos.")); + } } } diff --git a/modules/memoserv/list.cpp b/modules/memoserv/list.cpp index 0fd169cc2..4b8a4bff6 100644 --- a/modules/memoserv/list.cpp +++ b/modules/memoserv/list.cpp @@ -56,7 +56,9 @@ class CommandMSList : public Command mi = ci->GetMemos(); } else + { mi = source.nc->GetMemos(); + } if (!param.empty() && !isdigit(param[0]) && !param.equals_ci("NEW")) { diff --git a/modules/memoserv/main/memoserv.cpp b/modules/memoserv/main/memoserv.cpp index 364a22534..4fe747472 100644 --- a/modules/memoserv/main/memoserv.cpp +++ b/modules/memoserv/main/memoserv.cpp @@ -101,11 +101,11 @@ class MemoServCore : public Module, public MemoServ::MemoServService 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; - else if (!mi->GetMemoMax()) + if (!mi->GetMemoMax()) return MEMO_TARGET_FULL; - else if (mi->GetMemoMax() > 0 && mi->GetMemos().size() >= static_cast<unsigned>(mi->GetMemoMax())) + if (mi->GetMemoMax() > 0 && mi->GetMemos().size() >= static_cast<unsigned>(mi->GetMemoMax())) return MEMO_TARGET_FULL; - else if (mi->HasIgnore(sender)) + if (mi->HasIgnore(sender)) return MEMO_SUCCESS; } @@ -194,7 +194,9 @@ class MemoServCore : public Module, public MemoServ::MemoServService return ci->GetMemos(); } else + { is_registered = false; + } } else { @@ -211,7 +213,9 @@ class MemoServCore : public Module, public MemoServ::MemoServService return na->GetAccount()->GetMemos(); } else + { is_registered = false; + } } return NULL; diff --git a/modules/memoserv/read.cpp b/modules/memoserv/read.cpp index 62d6cd4d2..c875c8db9 100644 --- a/modules/memoserv/read.cpp +++ b/modules/memoserv/read.cpp @@ -93,7 +93,6 @@ class CommandMSRead : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - MemoServ::MemoInfo *mi; ChanServ::Channel *ci = NULL; Anope::string numstr = params[0], chan; @@ -119,7 +118,9 @@ class CommandMSRead : public Command mi = ci->GetMemos(); } else + { mi = source.nc->GetMemos(); + } if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && numstr.find_first_not_of("0123456789.,-") != Anope::string::npos)) { diff --git a/modules/memoserv/send.cpp b/modules/memoserv/send.cpp index 98567c3e2..418a82c21 100644 --- a/modules/memoserv/send.cpp +++ b/modules/memoserv/send.cpp @@ -56,11 +56,17 @@ class CommandMSSend : public Command Log(LOG_COMMAND, source, this) << "to send a memo to " << nick; } else if (result == MemoServ::MemoServService::MEMO_INVALID_TARGET) + { source.Reply(_("\002{0}\002 is not a registered unforbidden nick or channel."), nick); + } else if (result == MemoServ::MemoServService::MEMO_TOO_FAST) + { source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), Config->GetModule("memoserv/main")->Get<time_t>("senddelay"), source.command); + } else if (result == MemoServ::MemoServService::MEMO_TARGET_FULL) + { source.Reply(_("Sorry, \002{0}\002 currently has too many memos and cannot receive more."), nick); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/memoserv/set.cpp b/modules/memoserv/set.cpp index acb575084..13d24bd98 100644 --- a/modules/memoserv/set.cpp +++ b/modules/memoserv/set.cpp @@ -57,7 +57,9 @@ class CommandMSSet : public Command source.Reply(_("You will now be informed about new memos via email.")); } else + { source.Reply(_("There's no email address set for your nick.")); + } } else if (param.equals_ci("NOMAIL")) { @@ -72,7 +74,9 @@ class CommandMSSet : public Command source.Reply(_("\002{0}\002 will not send you any notification of memos."), MemoServ->nick); } else + { this->OnSyntaxError(source, ""); + } } void DoLimit(CommandSource &source, const std::vector<Anope::string> ¶ms, MemoServ::MemoInfo *mi) @@ -106,8 +110,10 @@ class CommandMSSet : public Command source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->GetName()); return; } + mi = ci->GetMemos(); } + if (is_servadmin) { if (!p2.empty() && !p2.equals_ci("HARD") && chan.empty()) @@ -185,7 +191,9 @@ class CommandMSSet : public Command return; } } + mi->SetMemoMax(limit); + if (limit > 0) { if (chan.empty() && nc == source.nc) @@ -248,6 +256,7 @@ class CommandMSSet : public Command Config->StrictPrivmsg, source.service->nick, help->cname, source.command); } else if (subcommand.equals_ci("NOTIFY")) + { source.Reply(_("Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002\n" "\n" "Changes when you will be notified about new memos:\n" @@ -270,6 +279,7 @@ class CommandMSSet : public Command " OFF You will not receive any notification of memos.\n" "\n" "\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined.")); + } else if (subcommand.equals_ci("LIMIT")) { int max_memos = Config->GetModule("memoserv/main")->Get<int>("maxmemos"); @@ -294,7 +304,9 @@ class CommandMSSet : public Command "However, you cannot set this any higher than {0}."), max_memos); } else + { return false; + } return true; } |
