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/operserv | |
| parent | 06f40cabcb167e2764c03092f6ec3f7383983f95 (diff) | |
Various codestyle cleanup in most of the core modules
Diffstat (limited to 'modules/operserv')
| -rw-r--r-- | modules/operserv/akill.cpp | 7 | ||||
| -rw-r--r-- | modules/operserv/config.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/dns.cpp | 2 | ||||
| -rw-r--r-- | modules/operserv/ignore.cpp | 4 | ||||
| -rw-r--r-- | modules/operserv/jupe.cpp | 39 | ||||
| -rw-r--r-- | modules/operserv/kill.cpp | 23 | ||||
| -rw-r--r-- | modules/operserv/logsearch.cpp | 6 | ||||
| -rw-r--r-- | modules/operserv/mode.cpp | 14 | ||||
| -rw-r--r-- | modules/operserv/modinfo.cpp | 51 | ||||
| -rw-r--r-- | modules/operserv/module.cpp | 10 | ||||
| -rw-r--r-- | modules/operserv/noop.cpp | 14 | ||||
| -rw-r--r-- | modules/operserv/oline.cpp | 4 | ||||
| -rw-r--r-- | modules/operserv/oper.cpp | 8 | ||||
| -rw-r--r-- | modules/operserv/set.cpp | 31 | ||||
| -rw-r--r-- | modules/operserv/shutdown.cpp | 3 | ||||
| -rw-r--r-- | modules/operserv/svs.cpp | 92 | ||||
| -rw-r--r-- | modules/operserv/sxline.cpp | 14 | ||||
| -rw-r--r-- | modules/operserv/update.cpp | 1 |
18 files changed, 218 insertions, 107 deletions
diff --git a/modules/operserv/akill.cpp b/modules/operserv/akill.cpp index 4da93ca05..9c4a53d23 100644 --- a/modules/operserv/akill.cpp +++ b/modules/operserv/akill.cpp @@ -54,8 +54,11 @@ class CommandOSAKill : public Command source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } - else if (expires > 0) + + if (expires > 0) + { expires += Anope::CurTime; + } if (sep.StreamEnd()) { @@ -83,7 +86,9 @@ class CommandOSAKill : public Command mask.trim(); } else + { reason = sep.GetRemaining(); + } if (mask[0] == '/' && mask[mask.length() - 1] == '/') { diff --git a/modules/operserv/config.cpp b/modules/operserv/config.cpp index 3935b4899..33ef0acef 100644 --- a/modules/operserv/config.cpp +++ b/modules/operserv/config.cpp @@ -125,7 +125,9 @@ class CommandOSConfig : public Command source.Reply(_("End of configuration.")); } else + { this->OnSyntaxError(source, what); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp index af07a2499..9afec4304 100644 --- a/modules/operserv/dns.cpp +++ b/modules/operserv/dns.cpp @@ -689,7 +689,9 @@ class CommandOSDNS : public Command } } else + { source.Reply(_("Unknown SET option.")); + } } void OnPool(CommandSource &source, const std::vector<Anope::string> ¶ms) diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp index 607163fb9..a25b0ef8c 100644 --- a/modules/operserv/ignore.cpp +++ b/modules/operserv/ignore.cpp @@ -160,7 +160,9 @@ class OSIgnoreService : public IgnoreService id->Delete(); } else + { return id; + } } return NULL; @@ -194,8 +196,10 @@ class CommandOSIgnore : public Command return mask; } else + { /* We have user@host. Add nick wildcard. */ return "*!" + mask; + } } /* We only got a nick.. */ diff --git a/modules/operserv/jupe.cpp b/modules/operserv/jupe.cpp index ccffcaf2a..2f9386eda 100644 --- a/modules/operserv/jupe.cpp +++ b/modules/operserv/jupe.cpp @@ -35,26 +35,35 @@ class CommandOSJupe : public Command Server *server = Server::Find(jserver, true); if (!IRCD->IsHostValid(jserver) || jserver.find('.') == Anope::string::npos) + { source.Reply(_("\002{0}\002 is not a valid server name."), jserver); - else if (server == Me || server == Servers::GetUplink() || server->IsULined()) + return; + } + + if (server == Me || server == Servers::GetUplink() || server->IsULined()) + { source.Reply(_("You can not jupe Servoces or its uplink server.")); - else if (server && server->IsJuped()) - source.Reply(_("You can not jupe an already juped server.")); - else + return; + } + + if (server && server->IsJuped()) { - Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : ""); - /* Generate the new sid before quitting the old server, so they can't collide */ - Anope::string sid = IRCD->SID_Retrieve(); - if (server) - { - IRCD->SendSquit(server, rbuf); - server->Delete(rbuf); - } - Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true); - IRCD->SendServer(juped_server); + source.Reply(_("You can not jupe an already juped server.")); + return; + } - Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")"; + Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : ""); + /* Generate the new sid before quitting the old server, so they can't collide */ + Anope::string sid = IRCD->SID_Retrieve(); + if (server) + { + IRCD->SendSquit(server, rbuf); + server->Delete(rbuf); } + Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true); + IRCD->SendServer(juped_server); + + Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")"; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/kill.cpp b/modules/operserv/kill.cpp index 224cf7bfd..e4c97bcf4 100644 --- a/modules/operserv/kill.cpp +++ b/modules/operserv/kill.cpp @@ -35,18 +35,23 @@ class CommandOSKill : public Command User *u2 = User::Find(nick, true); if (u2 == NULL) + { source.Reply(_("\002{0}\002 isn't currently online."), nick); - else if (u2->IsProtected() || u2->server == Me) - source.Reply(_("\002{0}\002 is protected and cannot be killed."), u2->nick); - else + return; + } + + if (u2->IsProtected() || u2->server == Me) { - if (reason.empty()) - reason = "No reason specified"; - if (Config->GetModule("operserv/main")->Get<bool>("addakiller")) - reason = "(" + source.GetNick() + ") " + reason; - Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason; - u2->Kill(*source.service, reason); + source.Reply(_("\002{0}\002 is protected and cannot be killed."), u2->nick); + return; } + + if (reason.empty()) + reason = "No reason specified"; + if (Config->GetModule("operserv/main")->Get<bool>("addakiller")) + reason = "(" + source.GetNick() + ") " + reason; + Log(LOG_ADMIN, source, this) << "on " << u2->nick << " for " << reason; + u2->Kill(*source.service, reason); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/logsearch.cpp b/modules/operserv/logsearch.cpp index 85a5834a7..d9dc7b891 100644 --- a/modules/operserv/logsearch.cpp +++ b/modules/operserv/logsearch.cpp @@ -107,7 +107,7 @@ class CommandOSLogSearch : public Command if (!fd.is_open()) continue; - for (Anope::string buf, token; std::getline(fd, buf.str());) + for (Anope::string buf; std::getline(fd, buf.str());) if (Anope::Match(buf, "*" + search_string + "*")) matches.push_back(buf); @@ -126,8 +126,8 @@ class CommandOSLogSearch : public Command source.Reply(_("Matches for \002{0}\002:"), search_string); unsigned count = 0; - for (std::list<Anope::string>::iterator it = matches.begin(), it_end = matches.end(); it != it_end; ++it) - source.Reply("#%d: %s", ++count, it->c_str()); + for (const Anope::string &str : matches) + source.Reply("#{0}: {1}", ++count, str); source.Reply(_("Showed \002{0}/{1}\002 matches for \002{2}\002."), matches.size(), found, search_string); } diff --git a/modules/operserv/mode.cpp b/modules/operserv/mode.cpp index a159dc3e3..a66f8897f 100644 --- a/modules/operserv/mode.cpp +++ b/modules/operserv/mode.cpp @@ -36,10 +36,18 @@ class CommandOSMode : public Command Reference<Channel> c = Channel::Find(target); if (!c) + { source.Reply(_("Channel \002{0}\002 doesn't exist."), target); - else if (c->bouncy_modes) + return; + } + + if (c->bouncy_modes) + { source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?")); - else if (modes.equals_ci("CLEAR")) + return; + } + + if (modes.equals_ci("CLEAR")) { bool all = params.size() > 2 && params[2].equals_ci("ALL"); @@ -69,7 +77,9 @@ class CommandOSMode : public Command source.Reply(_("All modes cleared on \002{0}\002."), c->name); } else + { source.Reply(_("Non-status modes cleared on \002{0}\002."), c->name); + } } else { diff --git a/modules/operserv/modinfo.cpp b/modules/operserv/modinfo.cpp index 57edc5c40..cd926d1e5 100644 --- a/modules/operserv/modinfo.cpp +++ b/modules/operserv/modinfo.cpp @@ -35,42 +35,43 @@ class CommandOSModInfo : public Command Log(LOG_ADMIN, source, this) << "on " << file; Module *m = ModuleManager::FindModule(file); - if (m) + if (m == nullptr) { - source.Reply(_("Module: \002{0}\002 Version: \002{1}\002 Author: \002{2}\002 Loaded: \002{3}\002"), m->name, !m->version.empty() ? m->version : "?", !m->author.empty() ? m->author : "Unknown", Anope::strftime(m->created, source.GetAccount())); - if (Anope::Debug) - source.Reply(_(" Loaded at: {0}"), Anope::printf("0x%x", m->handle)); + source.Reply(_("No information about module \002{0}\002 is available."), file); + return; + } + + source.Reply(_("Module: \002{0}\002 Version: \002{1}\002 Author: \002{2}\002 Loaded: \002{3}\002"), m->name, !m->version.empty() ? m->version : "?", !m->author.empty() ? m->author : "Unknown", Anope::strftime(m->created, source.GetAccount())); + if (Anope::Debug) + source.Reply(_(" Loaded at: {0}"), Anope::printf("0x%x", m->handle)); + + std::vector<Command *> commands = ServiceManager::Get()->FindServices<Command *>(); + for (Command *c : commands) + { + if (c->GetOwner() != m) + continue; + + source.Reply(_(" Providing service: \002{0}\002"), c->GetName()); - std::vector<Command *> commands = ServiceManager::Get()->FindServices<Command *>(); - for (Command *c : commands) + for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) { - if (c->GetOwner() != m) + User *u = it->second; + + if (u->type != UserType::BOT) continue; - source.Reply(_(" Providing service: \002{0}\002"), c->GetName()); + ServiceBot *bi = anope_dynamic_static_cast<ServiceBot *>(u); - for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) + for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit) { - User *u = it->second; - - if (u->type != UserType::BOT) + const Anope::string &c_name = cit->first; + const CommandInfo &info = cit->second; + if (info.name != c->GetName()) continue; - - ServiceBot *bi = anope_dynamic_static_cast<ServiceBot *>(u); - - for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit) - { - const Anope::string &c_name = cit->first; - const CommandInfo &info = cit->second; - if (info.name != c->GetName()) - continue; - source.Reply(_(" Command \002{0}\002 on \002{1}\002 is linked to \002{2}\002"), c_name, bi->nick, c->GetName()); - } + source.Reply(_(" Command \002{0}\002 on \002{1}\002 is linked to \002{2}\002"), c_name, bi->nick, c->GetName()); } } } - else - source.Reply(_("No information about module \002{0}\002 is available."), file); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/module.cpp b/modules/operserv/module.cpp index 88d1def03..1e4e0bac5 100644 --- a/modules/operserv/module.cpp +++ b/modules/operserv/module.cpp @@ -39,9 +39,13 @@ class CommandOSModLoad : public Command source.Reply(_("Module \002{0}\002 loaded."), mname); } else if (status == MOD_ERR_EXISTS) + { source.Reply(_("Module \002{0}\002 is already loaded."), mname); + } else + { source.Reply(_("Unable to load module \002{0}\002."), mname); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -108,7 +112,9 @@ class CommandOSModReLoad : public Command Anope::Quitting = true; } else + { source.Reply(_("Unable to load module \002{0}\002."), mname); + } } } @@ -155,9 +161,9 @@ class CommandOSModUnLoad : public Command source.Reply(_("Module \002{0}\002 unloaded."), mname); } else + { source.Reply(_("Unable to remove module \002{0}\002."), mname); - - return; + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/noop.cpp b/modules/operserv/noop.cpp index 7c4a178b4..2d813a0cc 100644 --- a/modules/operserv/noop.cpp +++ b/modules/operserv/noop.cpp @@ -36,10 +36,18 @@ class CommandOSNOOP : public Command Server *s = Server::Find(server, true); if (s == NULL) + { source.Reply(_("Server \002{0}\002 does not exist."), server); - else if (s == Me || s->IsJuped() || s->IsULined()) + return; + } + + if (s == Me || s->IsJuped() || s->IsULined()) + { source.Reply(_("You can not NOOP Services.")); - else if (cmd.equals_ci("SET")) + return; + } + + if (cmd.equals_ci("SET")) { /* Remove the O:lines */ IRCD->SendSVSNOOP(s, true); @@ -66,7 +74,9 @@ class CommandOSNOOP : public Command source.Reply(_("All O:lines of \002{0}\002 have been reset."), s->GetName()); } else + { this->OnSyntaxError(source, ""); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/oline.cpp b/modules/operserv/oline.cpp index a0b968325..9564dceac 100644 --- a/modules/operserv/oline.cpp +++ b/modules/operserv/oline.cpp @@ -52,9 +52,9 @@ class CommandOSOLine : public Command Log(LOG_ADMIN, source, this) << "for " << nick; } else + { this->OnSyntaxError(source, ""); - - return; + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/oper.cpp b/modules/operserv/oper.cpp index 40880d8fc..34fcb1abc 100644 --- a/modules/operserv/oper.cpp +++ b/modules/operserv/oper.cpp @@ -185,7 +185,9 @@ class CommandOSOper : public Command } if (ot->GetCommands().empty()) + { source.Reply(_("Opertype \002{0}\002 has no allowed commands."), ot->GetName()); + } else { source.Reply(_("Available commands for \002{0}\002:"), ot->GetName()); @@ -206,8 +208,11 @@ class CommandOSOper : public Command buf.clear(); } } + if (ot->GetPrivs().empty()) + { source.Reply(_("Opertype \002{0}\002 has no allowed privileges."), ot->GetName()); + } else { source.Reply(_("Available privileges for \002{0}\002:"), ot->GetName()); @@ -228,11 +233,14 @@ class CommandOSOper : public Command buf.clear(); } } + if (!ot->modes.empty()) source.Reply(_("Opertype \002{0}\002 receives modes \002{1}\002 once identified."), ot->GetName(), ot->modes); } else + { this->OnSyntaxError(source, subcommand); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/set.cpp b/modules/operserv/set.cpp index f12f43722..e23efb849 100644 --- a/modules/operserv/set.cpp +++ b/modules/operserv/set.cpp @@ -26,16 +26,16 @@ class CommandOSSet : public Command { Log(LOG_ADMIN, source, this) << "LIST"; - Anope::string index; + const char *str; - index = Anope::ReadOnly ? _("%s is enabled") : _("%s is disabled"); - source.Reply(index.c_str(), "READONLY"); - index = Anope::Debug ? _("%s is enabled") : _("%s is disabled"); - source.Reply(index.c_str(), "DEBUG"); - index = Anope::NoExpire ? _("%s is enabled") : _("%s is disabled"); - source.Reply(index.c_str(), "NOEXPIRE"); + str = Anope::ReadOnly ? _("{0} is enabled") : _("{0} is disabled"); + source.Reply(str, "READONLY"); - return; + str = Anope::Debug ? _("{0} is enabled") : _("{0} is disabled"); + source.Reply(str, "DEBUG"); + + str = Anope::NoExpire ? _("{0} is enabled") : _("{0} is disabled"); + source.Reply(str, "NOEXPIRE"); } void DoSetReadOnly(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -61,7 +61,9 @@ class CommandOSSet : public Command source.Reply(_("Services are now in \002read-write\002 mode.")); } else + { source.Reply(_("Setting for READONLY must be \002ON\002 or \002OFF\002.")); + } } void DoSetSuperAdmin(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -84,8 +86,12 @@ class CommandOSSet : public Command **/ bool super_admin = Config->GetModule(this->GetOwner())->Get<bool>("superadmin"); if (!super_admin) + { source.Reply(_("Super admin can not be set because it is not enabled in the configuration.")); - else if (setting.equals_ci("ON")) + return; + } + + if (setting.equals_ci("ON")) { source.GetUser()->super_admin = true; source.Reply(_("You are now a super admin.")); @@ -98,7 +104,9 @@ class CommandOSSet : public Command Log(LOG_ADMIN, source, this) << "SUPERADMIN OFF"; } else + { source.Reply(_("Setting for super admin must be \002ON\002 or \002OFF\002.")); + } } void DoSetDebug(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -136,8 +144,6 @@ class CommandOSSet : public Command source.Reply(_("Setting for DEBUG must be \002ON\002, \002OFF\002, or a positive number.")); } - - return; } void DoSetNoExpire(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -163,7 +169,9 @@ class CommandOSSet : public Command source.Reply(_("Services are now in \002expire\002 mode.")); } else + { source.Reply(_("Setting for NOEXPIRE must be \002ON\002 or \002OFF\002.")); + } } public: CommandOSSet(Module *creator) : Command(creator, "operserv/set", 1, 2) @@ -202,6 +210,7 @@ class CommandOSSet : public Command " LIST List the options")); } else if (subcommand.equals_ci("LIST")) +#warning "?" //source.Reply(_("Syntax: \002LIST\002\n" // " \n" source.Reply(("Display the various {0} settings."), source.service->nick); diff --git a/modules/operserv/shutdown.cpp b/modules/operserv/shutdown.cpp index c0adc182e..3b04528d5 100644 --- a/modules/operserv/shutdown.cpp +++ b/modules/operserv/shutdown.cpp @@ -32,7 +32,6 @@ class CommandOSQuit : public Command Log(LOG_ADMIN, source, this); Anope::QuitReason = source.command + " command received from " + source.GetNick(); Anope::Quitting = true; - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -58,7 +57,6 @@ class CommandOSRestart : public Command Anope::QuitReason = source.command + " command received from " + source.GetNick(); Anope::Quitting = Anope::Restarting = true; Anope::SaveDatabases(); - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -82,7 +80,6 @@ class CommandOSShutdown : public Command Anope::QuitReason = source.command + " command received from " + source.GetNick(); Anope::Quitting = true; Anope::SaveDatabases(); - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/svs.cpp b/modules/operserv/svs.cpp index 0a5acac2f..81138740f 100644 --- a/modules/operserv/svs.cpp +++ b/modules/operserv/svs.cpp @@ -32,7 +32,6 @@ class CommandOSSVSNick : public Command { const Anope::string &nick = params[0]; Anope::string newnick = params[1]; - User *u2; if (!IRCD->CanSVSNick) { @@ -55,17 +54,22 @@ class CommandOSSVSNick : public Command return; } - /* Check for a nick in use or a forbidden/suspended nick */ - if (!(u2 = User::Find(nick, true))) + User *u2 = User::Find(nick, true); + if (u2 == nullptr) + { source.Reply(_("\002{0}\002 isn't currently online."), nick); - else if (!nick.equals_ci(newnick) && User::Find(newnick)) - source.Reply(_("\002{0}\002 is currently in use."), newnick); - else + return; + } + + if (!nick.equals_ci(newnick) && User::Find(newnick, true)) { - source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick); - Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick; - IRCD->SendForceNickChange(u2, newnick, Anope::CurTime); + source.Reply(_("\002{0}\002 is currently in use."), newnick); + return; } + + source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick); + Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick; + IRCD->SendForceNickChange(u2, newnick, Anope::CurTime); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -95,19 +99,32 @@ class CommandOSSVSJoin : public Command User *target = User::Find(params[0], true); Channel *c = Channel::Find(params[1]); if (target == NULL) + { source.Reply(_("\002{0}\002 isn't currently online."), params[0]); - else if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) + return; + } + + if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) + { source.Reply(_("Access denied.")); - else if (!c && !IRCD->IsChannelValid(params[1])) + return; + } + + if (!c && !IRCD->IsChannelValid(params[1])) + { source.Reply(_("\002{0}\002 isn't a valid channel."), params[1]); - else if (c && c->FindUser(target)) - source.Reply(_("\002{0}\002 is already in \002{1}\002."), target->nick, c->name); - else + return; + } + + if (c && c->FindUser(target)) { - IRCD->SendSVSJoin(*source.service, target, params[1], ""); - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1]; - source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]); + source.Reply(_("\002{0}\002 is already in \002{1}\002."), target->nick, c->name); + return; } + + IRCD->SendSVSJoin(*source.service, target, params[1], ""); + Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1]; + source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -135,25 +152,38 @@ class CommandOSSVSPart : public Command } User *target = User::Find(params[0], true); - Channel *c = Channel::Find(params[1]); - const Anope::string &reason = params.size() > 2 ? params[2] : ""; - if (target == NULL) + if (target == nullptr) + { source.Reply(_("\002{0}\002 isn't currently online."), params[0]); - else if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) + return; + } + + if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) + { source.Reply(_("Access denied.")); - else if (!c) + return; + } + + Channel *c = Channel::Find(params[1]); + if (!c) + { source.Reply(_("Channel \002{0}\002 doesn't exist."), params[1]); - else if (!c->FindUser(target)) - source.Reply(_("\002{0}\002 is not in \002{1}\002."), target->nick, c->name); - else + return; + } + + if (!c->FindUser(target)) { - IRCD->SendSVSPart(*source.service, target, params[1], reason); - if (!reason.empty()) - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason; - else - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; - source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name); + source.Reply(_("\002{0}\002 is not in \002{1}\002."), target->nick, c->name); + return; } + + const Anope::string &reason = params.size() > 2 ? params[2] : ""; + IRCD->SendSVSPart(*source.service, target, params[1], reason); + if (!reason.empty()) + Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason; + else + Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; + source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/sxline.cpp b/modules/operserv/sxline.cpp index cc6b9669c..bd0dc8910 100644 --- a/modules/operserv/sxline.cpp +++ b/modules/operserv/sxline.cpp @@ -143,7 +143,9 @@ class CommandOSSXLineBase : public Command } if (list.IsEmpty()) + { source.Reply(_("No matching entries on the {0} list."), source.command); + } else { source.Reply(_("{0} list:"), source.command); @@ -408,9 +410,12 @@ class CommandOSSNLine : public CommandOSSXLineBase } } else if (subcommand.equals_ci("DEL")) + { source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list if it is present." " If a list of entry numbers is given, those entries are deleted.")); + } else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + { source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands displays the {0} list.\n" "If a wildcard \037mask\037 is given, only those entries matching the \037mask\037 are displayed." " If a list of entry numbers is given, only those entries are shown." @@ -421,9 +426,12 @@ class CommandOSSNLine : public CommandOSSXLineBase " {0} LIST 2-5,7-9\n" " Lists {0} entries numbered 2 through 5 and 7 through 9.\n"), source.command); + } else if (subcommand.equals_ci("CLEAR")) + { source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."), source.command); + } else { CommandInfo *help = source.service->FindCommand("generic/help"); @@ -645,9 +653,12 @@ class CommandOSSQLine : public CommandOSSXLineBase } } else if (subcommand.equals_ci("DEL")) + { source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list if it is present." " If a list of entry numbers is given, those entries are deleted.")); + } else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + { source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands displays the {0} list.\n" "If a wildcard \037mask\037 is given, only those entries matching the \037mask\037 are displayed." " If a list of entry numbers is given, only those entries are shown." @@ -658,9 +669,12 @@ class CommandOSSQLine : public CommandOSSXLineBase " {0} LIST 2-5,7-9\n" " Lists {0} entries numbered 2 through 5 and 7 through 9.\n"), source.command); + } else if (subcommand.equals_ci("CLEAR")) + { source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."), source.command); + } else { CommandInfo *help = source.service->FindCommand("generic/help"); diff --git a/modules/operserv/update.cpp b/modules/operserv/update.cpp index 753644415..f12047732 100644 --- a/modules/operserv/update.cpp +++ b/modules/operserv/update.cpp @@ -32,7 +32,6 @@ class CommandOSUpdate : public Command Log(LOG_ADMIN, source, this); source.Reply(_("Updating databases.")); Anope::SaveDatabases(); - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override |
