summaryrefslogtreecommitdiff
path: root/modules/commands/os_noop.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-06 00:00:36 -0500
committerAdam <Adam@anope.org>2012-11-06 11:02:12 -0500
commit4cfd4688636ff9ba033f2578b673c1ddf3aaf96f (patch)
treede7c36f2b422fe0bf66add50deec27ffd065b4a3 /modules/commands/os_noop.cpp
parent0cf8d733953fd9c856c0519f2bccc94a3cb2eafa (diff)
Made os_noop more useful
Diffstat (limited to 'modules/commands/os_noop.cpp')
-rw-r--r--modules/commands/os_noop.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/modules/commands/os_noop.cpp b/modules/commands/os_noop.cpp
index edb5b2eca..826f1313a 100644
--- a/modules/commands/os_noop.cpp
+++ b/modules/commands/os_noop.cpp
@@ -18,7 +18,7 @@ class CommandOSNOOP : public Command
public:
CommandOSNOOP(Module *creator) : Command(creator, "operserv/noop", 2, 2)
{
- this->SetDesc(_("Temporarily remove all O:lines of a server remotely"));
+ this->SetDesc(_("Remove all operators from a server remotely"));
this->SetSyntax(_("SET \037server\037"));
this->SetSyntax(_("REVOKE \037server\037"));
}
@@ -31,13 +31,16 @@ class CommandOSNOOP : public Command
Server *s = Server::Find(server);
if (s == NULL)
source.Reply(_("Server %s does not exist."), server.c_str());
+ else if (s == Me || s->HasFlag(SERVER_JUPED))
+ source.Reply(_("You may not NOOP services."));
else if (cmd.equals_ci("SET"))
{
/* Remove the O:lines */
ircdproto->SendSVSNOOP(s, true);
+ s->Extend("noop", new ExtensibleItemClass<Anope::string>(source.GetNick()));
Log(LOG_ADMIN, source, this) << "SET on " << s->GetName();
- source.Reply(_("All O:lines of \002%s\002 have been removed."), s->GetName().c_str());
+ source.Reply(_("All operators from \002%s\002 have been removed."), s->GetName().c_str());
Anope::string reason = "NOOP command used by " + source.GetNick();
/* Kill all the IRCops of the server */
@@ -46,32 +49,29 @@ class CommandOSNOOP : public Command
User *u2 = it->second;
++it;
- if (u2 && u2->HasMode(UMODE_OPER) && u2->server == s)
+ if (u2->server == s && u2->HasMode(UMODE_OPER))
u2->Kill(Config->OperServ, reason);
}
}
else if (cmd.equals_ci("REVOKE"))
{
- Log(LOG_ADMIN, source, this) << "REVOKE on " << s->GetName();
+ s->Shrink("noop");
ircdproto->SendSVSNOOP(s, false);
+ Log(LOG_ADMIN, source, this) << "REVOKE on " << s->GetName();
source.Reply(_("All O:lines of \002%s\002 have been reset."), s->GetName().c_str());
}
else
this->OnSyntaxError(source, "");
-
- return;
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
- source.Reply(_("\002NOOP SET\002 remove all O:lines of the given\n"
- "\002server\002 and kill all IRCops currently on it to\n"
- "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"));
+ source.Reply(_("\002SET\002 kills all operators from the given\n"
+ "\002server\002 and prevents operators from opering\n"
+ "up on the given server. \002REVOKE\002 removes this\n"
+ "restriction."));
return true;
}
};
@@ -86,6 +86,20 @@ class OSNOOP : public Module
{
this->SetAuthor("Anope");
+ ModuleManager::Attach(I_OnUserModeSet, this);
+ }
+
+ void OnUserModeSet(User *u, UserModeName Name) anope_override
+ {
+ if (Name == UMODE_OPER && u->server->HasExt("noop"))
+ {
+ Anope::string *setter = u->server->GetExt<ExtensibleItemClass<Anope::string> *>("noop");
+ if (setter)
+ {
+ Anope::string reason = "NOOP command used by " + *setter;
+ u->Kill(Config->OperServ, reason);
+ }
+ }
}
};