summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-04-22 15:59:32 +0000
committerrubidium <rubidium@openttd.org>2011-04-22 15:59:32 +0000
commitcaf02450fb4937f08027903ff17ddc174004c2f2 (patch)
tree2c1eb253c42ee7b57dbf8ef795b3427375ce3062 /src/console_cmds.cpp
parent1c419d99bcb72eb198796f1695c003b3736abe8f (diff)
downloadopenttd-caf02450fb4937f08027903ff17ddc174004c2f2.tar.xz
(svn r22365) -Codechange: add overload of NetworkServerKickOrBanIP using the ClientID, which later resolves the IP address to ban. This to consolidate the knowledge about resolving IP addresses
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 9f8591dcb..caee5190f 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -490,7 +490,7 @@ DEF_CONSOLE_CMD(ConClearBuffer)
static bool ConKickOrBan(const char *argv, bool ban)
{
- const char *ip = argv;
+ uint n;
if (strchr(argv, '.') == NULL && strchr(argv, ':') == NULL) { // banning with ID
ClientID client_id = (ClientID)atoi(argv);
@@ -513,10 +513,11 @@ static bool ConKickOrBan(const char *argv, bool ban)
}
/* When banning, kick+ban all clients with that IP */
- ip = GetClientIP(ci);
+ n = NetworkServerKickOrBanIP(client_id, ban);
+ } else {
+ n = NetworkServerKickOrBanIP(argv, ban);
}
- uint n = NetworkServerKickOrBanIP(ip, ban);
if (n == 0) {
IConsolePrint(CC_DEFAULT, ban ? "Client not online, address added to banlist" : "Client not found");
} else {