summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2005-10-19 19:38:35 +0000
committerDarkvater <Darkvater@openttd.org>2005-10-19 19:38:35 +0000
commit7b52c5f6bb1c562bdf48b201d096b0499cde5301 (patch)
tree642308a8906862b991147b781f65099cb90bbcea /console_cmds.c
parent71d293f2a3a469b82804049d8e5325d82681d2f8 (diff)
downloadopenttd-7b52c5f6bb1c562bdf48b201d096b0499cde5301.tar.xz
(svn r3067) - Feature: allow unbanning players based on banlist-id (as well as IP).
- Feature: 'status' and 'clients' now show the IP of the players
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 93253b2e3..b4926e1b0 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -404,20 +404,24 @@ DEF_CONSOLE_CMD(ConBan)
DEF_CONSOLE_CMD(ConUnBan)
{
- uint i;
+ uint i, index;
if (argc == 0) {
- IConsoleHelp("Unban a player from a network game. Usage: 'unban <ip>'");
+ IConsoleHelp("Unban a player from a network game. Usage: 'unban <ip\\id>'");
+ IConsoleHelp("For a list of banned IP's, see the command 'banlist'");
return true;
}
if (argc != 2) return false;
+ index = (strrchr(argv[1], '.') == '\0') ? atoi(argv[1]) : 0;
+ index--;
+
for (i = 0; i < lengthof(_network_ban_list); i++) {
if (_network_ban_list[i] == NULL || _network_ban_list[i][0] == '\0')
continue;
- if (strncmp(_network_ban_list[i], argv[1], strlen(_network_ban_list[i])) == 0) {
+ if (strncmp(_network_ban_list[i], argv[1], strlen(_network_ban_list[i])) == 0 || index == i) {
_network_ban_list[i][0] = '\0';
IConsolePrint(_icolour_def, "IP unbanned.");
return true;
@@ -511,8 +515,8 @@ DEF_CONSOLE_CMD(ConStatus)
const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
status = (cs->status <= STATUS_ACTIVE) ? stat_str[cs->status] : "unknown";
- IConsolePrintF(8, "Client #%d/%s status: %s frame-lag: %d play-as: %d unique-id: %s",
- cs->index, ci->client_name, status, lag, ci->client_playas, ci->unique_id);
+ IConsolePrintF(8, "Client #%1d name: '%s' status: '%s' frame-lag: %3d company: %1d IP: %s unique-id: '%s'",
+ cs->index, ci->client_name, status, lag, ci->client_playas, GetPlayerIP(ci), ci->unique_id);
}
return true;
@@ -613,13 +617,14 @@ DEF_CONSOLE_CMD(ConNetworkClients)
NetworkClientInfo *ci;
if (argc == 0) {
- IConsoleHelp("Get a list of connected clients including their ID, name, and company-id. Usage: 'clients'");
+ IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'");
return true;
}
for (ci = _network_client_info; ci != &_network_client_info[MAX_CLIENT_INFO]; ci++) {
if (ci->client_index != NETWORK_EMPTY_INDEX) {
- IConsolePrintF(8, "Client #%d name: %s play-as company: %d", ci->client_index, ci->client_name, ci->client_playas);
+ IConsolePrintF(8, "Client #%1d name: '%s' company: %1d IP: %s",
+ ci->client_index, ci->client_name, ci->client_playas, GetPlayerIP(ci));
}
}