summaryrefslogtreecommitdiff
path: root/src/modules/m_jumpserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_jumpserver.cpp')
-rw-r--r--src/modules/m_jumpserver.cpp34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index dce8f0bd5..2bcef9836 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -53,9 +53,9 @@ class CommandJumpserver : public Command
if (!parameters.size())
{
if (port)
- user->WriteServ("NOTICE %s :*** Disabled jumpserver (previously set to '%s:%d')", user->nick.c_str(), redirect_to.c_str(), port);
+ user->WriteNotice("*** Disabled jumpserver (previously set to '" + redirect_to + ":" + ConvToStr(port) + "')");
else
- user->WriteServ("NOTICE %s :*** Jumpserver was not enabled.", user->nick.c_str());
+ user->WriteNotice("*** Jumpserver was not enabled.");
port = 0;
redirect_to.clear();
@@ -84,7 +84,7 @@ class CommandJumpserver : public Command
redirect_new_users = direction;
break;
default:
- user->WriteServ("NOTICE %s :*** Invalid JUMPSERVER flag: %c", user->nick.c_str(), *n);
+ user->WriteNotice("*** Invalid JUMPSERVER flag: " + ConvToStr(*n));
return CMD_FAILURE;
break;
}
@@ -92,7 +92,7 @@ class CommandJumpserver : public Command
if (!atoi(parameters[1].c_str()))
{
- user->WriteServ("NOTICE %s :*** Invalid port number", user->nick.c_str());
+ user->WriteNotice("*** Invalid port number");
return CMD_FAILURE;
}
@@ -102,7 +102,7 @@ class CommandJumpserver : public Command
for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
{
User* t = *i;
- if (!IS_OPER(t))
+ if (!t->IsOper())
{
t->WriteNumeric(10, "%s %s %s :Please use this Server/Port instead", t->nick.c_str(), parameters[0].c_str(), parameters[1].c_str());
ServerInstance->Users->QuitUser(t, reason);
@@ -121,20 +121,15 @@ class CommandJumpserver : public Command
port = atoi(parameters[1].c_str());
}
- user->WriteServ("NOTICE %s :*** Set jumpserver to server '%s' port '%s', flags '+%s%s'%s%s%s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[1].c_str(),
- redirect_all_immediately ? "a" : "",
- redirect_new_users ? "n" : "",
- n_done ? " (" : "",
- n_done ? n_done_s.c_str() : "",
- n_done ? " user(s) redirected)" : "",
- reason.c_str());
+ user->WriteNotice("*** Set jumpserver to server '" + parameters[0] + "' port '" + parameters[1] + "', flags '+" +
+ (redirect_all_immediately ? "a" : "") + (redirect_new_users ? "n'" : "'") +
+ (n_done ? " (" + n_done_s + "user(s) redirected): " : ": ") + reason);
}
return CMD_SUCCESS;
}
};
-
class ModuleJumpServer : public Module
{
CommandJumpserver js;
@@ -143,18 +138,14 @@ class ModuleJumpServer : public Module
{
}
- void init()
+ void init() CXX11_OVERRIDE
{
ServerInstance->Modules->AddService(js);
Implementation eventlist[] = { I_OnUserRegister, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- virtual ~ModuleJumpServer()
- {
- }
-
- virtual ModResult OnUserRegister(LocalUser* user)
+ ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE
{
if (js.port && js.redirect_new_users)
{
@@ -166,17 +157,16 @@ class ModuleJumpServer : public Module
return MOD_RES_PASSTHRU;
}
- virtual void OnRehash(User* user)
+ void OnRehash(User* user) CXX11_OVERRIDE
{
// Emergency way to unlock
if (!user) js.redirect_new_users = false;
}
- virtual Version GetVersion()
+ Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for the RPL_REDIR numeric and the /JUMPSERVER command.", VF_VENDOR);
}
-
};
MODULE_INIT(ModuleJumpServer)