diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-10-21 15:10:44 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-10-21 15:10:44 +0200 |
commit | 569a742b9420b62a538c27fbd38a2bb8db6b9ca6 (patch) | |
tree | 662b4f7ce703540fee6e5896200622c2ee22b4a4 /src/commands | |
parent | ab9de30e778a53dacf7175c6524a316da4f93640 (diff) |
Make better use of User::GetFullRealHost()
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/cmd_die.cpp | 6 | ||||
-rw-r--r-- | src/commands/cmd_kill.cpp | 4 | ||||
-rw-r--r-- | src/commands/cmd_oper.cpp | 7 | ||||
-rw-r--r-- | src/commands/cmd_restart.cpp | 4 |
4 files changed, 9 insertions, 12 deletions
diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 9b0126e3e..1d6640213 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -49,7 +49,7 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User * if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0].c_str(), ServerInstance->Config->powerhash)) { { - std::string diebuf = "*** DIE command from " + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating."; + std::string diebuf = "*** DIE command from " + user->GetFullHost() + ". Terminating."; ServerInstance->Logs->Log("COMMAND",SPARSE, diebuf); ServerInstance->SendError(diebuf); } @@ -58,8 +58,8 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User * } else { - ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); - ServerInstance->SNO->WriteGlobalSno('a', "Failed DIE Command from %s!%s@%s.",user->nick.c_str(),user->ident.c_str(),user->host.c_str()); + ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s", user->GetFullRealHost().c_str()); + ServerInstance->SNO->WriteGlobalSno('a', "Failed DIE Command from %s.", user->GetFullRealHost().c_str()); return CMD_FAILURE; } return CMD_SUCCESS; diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 99ead1b7d..463c7af38 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -111,7 +111,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User if (!IS_LOCAL(u)) { // remote kill - ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host.c_str(), parameters[1].c_str()); + ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason)); } else @@ -121,7 +121,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User * XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill * snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t */ - ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host.c_str(), parameters[1].c_str()); + ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s (%s)", user->nick.c_str(), u->GetFullRealHost().c_str(), parameters[1].c_str()); ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName.c_str(), user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show * hidekillsserver as source if possible diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index e3f79d347..1a5e7e178 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -84,7 +84,6 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L return CMD_SUCCESS; } } - char broadcast[MAXBUF]; std::string fields; if (!match_login) @@ -98,10 +97,8 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick.c_str()); user->CommandFloodPenalty += 10000; - snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str()); - ServerInstance->SNO->WriteGlobalSno('o',std::string(broadcast)); - - ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str()); + ServerInstance->SNO->WriteGlobalSno('o', "WARNING! Failed oper attempt by %s using login '%s': The following fields do not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s using login '%s': The following fields did not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index b94dbaac9..dc5507548 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -42,7 +42,7 @@ CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, Us ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick.c_str()); if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash)) { - ServerInstance->SNO->WriteGlobalSno('a', "RESTART command from %s!%s@%s, restarting server.", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); + ServerInstance->SNO->WriteGlobalSno('a', "RESTART command from %s, restarting server.", user->GetFullRealHost().c_str()); ServerInstance->SendError("Server restarting."); execv(ServerInstance->Config->cmdline.argv[0], ServerInstance->Config->cmdline.argv); @@ -51,7 +51,7 @@ CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, Us } else { - ServerInstance->SNO->WriteGlobalSno('a', "Failed RESTART Command from %s!%s@%s.", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); + ServerInstance->SNO->WriteGlobalSno('a', "Failed RESTART Command from %s.", user->GetFullRealHost().c_str()); } return CMD_FAILURE; } |