diff options
author | rubidium <rubidium@openttd.org> | 2011-04-22 15:59:32 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-04-22 15:59:32 +0000 |
commit | caf02450fb4937f08027903ff17ddc174004c2f2 (patch) | |
tree | 2c1eb253c42ee7b57dbf8ef795b3427375ce3062 /src/network | |
parent | 1c419d99bcb72eb198796f1695c003b3736abe8f (diff) | |
download | openttd-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/network')
-rw-r--r-- | src/network/network_func.h | 1 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 2 | ||||
-rw-r--r-- | src/network/network_server.cpp | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/network/network_func.h b/src/network/network_func.h index 4649d09ad..0d9e86f95 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -75,6 +75,7 @@ void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const cha void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, ClientID from_id, int64 data = 0, bool from_admin = false); void NetworkServerKickClient(ClientID client_id); +uint NetworkServerKickOrBanIP(ClientID client_id, bool ban); uint NetworkServerKickOrBanIP(const char *ip, bool ban); void NetworkInitChatMessage(); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index fef064a69..164f601bd 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1717,7 +1717,7 @@ static void ClientList_Kick(const NetworkClientInfo *ci) static void ClientList_Ban(const NetworkClientInfo *ci) { - NetworkServerKickOrBanIP(GetClientIP(const_cast<NetworkClientInfo *>(ci)), true); + NetworkServerKickOrBanIP(ci->client_id, true); } static void ClientList_GiveMoney(const NetworkClientInfo *ci) diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 8851d1810..581596eb0 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1919,6 +1919,11 @@ void NetworkServerKickClient(ClientID client_id) NetworkServerSendError(client_id, NETWORK_ERROR_KICKED); } +uint NetworkServerKickOrBanIP(ClientID client_id, bool ban) +{ + return NetworkServerKickOrBanIP(GetClientIP(NetworkClientInfo::GetByClientID(client_id)), ban); +} + uint NetworkServerKickOrBanIP(const char *ip, bool ban) { /* Add address to ban-list */ |