diff options
| author | Adam <Adam@anope.org> | 2011-05-03 00:13:19 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-05-16 04:10:18 -0400 |
| commit | b59602abf85d522bb2f188be70b6cb7c9556a856 (patch) | |
| tree | 77ffb4df0714463da7cf8c9531e90fad4c763aed /modules/core | |
| parent | fd21c36725fc52fd186e058bb2b5f6c4c37b81bb (diff) | |
Check for a valid server in /operserv noop
Diffstat (limited to 'modules/core')
| -rw-r--r-- | modules/core/os_noop.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index a8c0f9559..b17f26dfc 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -28,34 +28,37 @@ class CommandOSNOOP : public Command const Anope::string &cmd = params[0]; const Anope::string &server = params[1]; - if (cmd.equals_ci("SET")) + Server *s = Server::Find(server); + if (s == NULL) + source.Reply(_("Server %s does not exist."), server.c_str()); + else if (cmd.equals_ci("SET")) { - Anope::string reason; - /* Remove the O:lines */ - ircdproto->SendSVSNOOP(server, 1); + ircdproto->SendSVSNOOP(s, true); - reason = "NOOP command used by " + u->nick; - Log(LOG_ADMIN, u, this) << "on " << server; - source.Reply(_("All O:lines of \002%s\002 have been removed."), server.c_str()); + Log(LOG_ADMIN, u, this) << "SET on " << s->GetName(); + source.Reply(_("All O:lines of \002%s\002 have been removed."), s->GetName().c_str()); + Anope::string reason = "NOOP command used by " + u->nick; /* Kill all the IRCops of the server */ for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end();) { User *u2 = it->second; ++it; - if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true)) + if (u2 && u2->HasMode(UMODE_OPER) && u2->server == s) u2->Kill(Config->s_OperServ, reason); } } else if (cmd.equals_ci("REVOKE")) { - ircdproto->SendSVSNOOP(server, 0); - source.Reply(_("All O:lines of \002%s\002 have been reset."), server.c_str()); + Log(LOG_ADMIN, u, this) << "REVOKE on " << s->GetName(); + ircdproto->SendSVSNOOP(s, false); + source.Reply(_("All O:lines of \002%s\002 have been reset."), s->GetName().c_str()); } else this->OnSyntaxError(source, ""); + return MOD_CONT; } @@ -69,9 +72,7 @@ class CommandOSNOOP : public Command "prevent them from rehashing the server (because this\n" "would just cancel the effect).\n" "\002NOOP REVOKE\002 makes all removed O:lines available again\n" - "on the given \002server\002.\n" - "\002Note:\002 The \002server\002 is not checked at all by the\n" - "Services.")); + "on the given \002server\002.\n")); return true; } |
